Joshua Johnston added the comment: 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> ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18857> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com