Don't think this is really right if you consider the desire to be able to pass integers (like 0), which others have requested before.
What precedent is there to passing the value None being converted to empty string? - C On Sat, 2011-05-21 at 18:35 -0700, Jerry wrote: > Google group messes with the formatting, which should have been -- > > else: > if v.__class__ is unicode: > v = v.encode('utf-8') > if v: > v = quote_plus(str(v)) > result += '%s%s=%s' % (prefix, k, v) > else: > result += '%s%s=' % (prefix, k) > > Jerry > > On May 22, 9:32 am, Jerry <jerryji1...@gmail.com> wrote: > > Hi, > > > > Pyramid's route_url/route_path behavior with None _query terms doesn't > > seem very canonical to me -- > > > > (Pdb) request.route_path('home', _query=[('q', None)]) > > '/home?q=None' > > > > Omitting value is more like it -- > > > > (Pdb) request.route_path('home', _query=[('q', '')]) > > '/home?q=' > > > > so is omitting both -- > > > > (Pdb) request.route_path('home', _query=[('q', [])]) > > '/home?' > > > > Chris and other Pyramid maintainers: would you consider adding this > > simple check to urlencode() in pyramid/encode.py ? -- > > > > 89 for (k, v) in query: > > 90 if k.__class__ is unicode: > > 91 k = k.encode('utf-8') > > 92 k = quote_plus(str(k)) > > 93 if hasattr(v, '__iter__'): > > 94 for x in v: > > 95 if x.__class__ is unicode: > > 96 x = x.encode('utf-8') > > 97 x = quote_plus(str(x)) > > 98 result += '%s%s=%s' % (prefix, k, x) > > 99 prefix = '&' > > 100 else: > > 101 if v.__class__ is unicode: > > 102 v = v.encode('utf-8') > > if v: > > 103 v = quote_plus(str(v)) > > 104 result += '%s%s=%s' % (prefix, k, v) > > else: > > result += '%s%s=' % (prefix, k) > > 105 prefix = '&' > > > > Thanks. > > > > Jerry > -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com. To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.