This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Joshua.Johnston
Recipients Claudiu.Popa, Joshua.Johnston, ezio.melotti, orsenthil, r.david.murray
Date 2014-02-07.17:25:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1391793939.29.0.0328048997594.issue18857@psf.upfronthosting.co.za>
In-reply-to
Content
In this exact example it would be an empty string. It was a fake setup to illustrate a real problem.

This is the important part:

params = dict(screen_name=None,count=300)
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&count=300"

screen_name=None is not the behavior you would want.

Another example is in webapp2's uri_for function which uses urlencode internally.
ref: http://stackoverflow.com/questions/7081250/webapp2-jinja2-how-can-i-get-uri-for-working-in-jinja2-views

If you try to use uri_for in your jinja2 template you must jump through hoops like:

<script>
{% if screen_name %}
   var url = '{{ uri_for('something', screen_name=screen_name) }}';
{% else %}
   var url = '{{ uri_for('something') }}';
{% endif %}
</script>
History
Date User Action Args
2014-02-07 17:25:39Joshua.Johnstonsetrecipients: + Joshua.Johnston, orsenthil, ezio.melotti, r.david.murray, Claudiu.Popa
2014-02-07 17:25:39Joshua.Johnstonsetmessageid: <1391793939.29.0.0328048997594.issue18857@psf.upfronthosting.co.za>
2014-02-07 17:25:39Joshua.Johnstonlinkissue18857 messages
2014-02-07 17:25:39Joshua.Johnstoncreate