Message 210488 - Python tracker (original) (raw)

I'm sorry to reopen this but after it biting me quite a few times more I still cannot think of a valid use-case for this behavior that someone would be depending on 'None' being passed.

I think your backwards compatibility concerns are artificial. Can anyone describe a use-case that depended on arg=None being passed in a query string?

I am sure that anyone who is encountering this behavior is treating the string 'None' as None when encountered in a request query string.

Consider this example usage. A website presents a user with a form to search their twitter followers using the twitter api https://api.twitter.com/1.1/friends/ids.json

Form fields optional screen_name: [________] (assume more fields)

Handler gets the form post and builds the dict for the search query string.

User entered nothing so params = {'screen_name': None, ..more fields}

params = {k: self.request.get(k, None) for k in self.request.GET}

url = "https://api.twitter.com/1.1/friends/ids.json?" + urllib.urlencode(params)

print url "https://api.twitter.com/1.1/friends/ids.json?screen_name=None"

This would cause the twitter search api to look for your friends with None in their screen name. Not exactly what you'd expect right?