Ticket #1862: tg-1.0-url_encoding.patch

File tg-1.0-url_encoding.patch, 0.8 kB (added by wmark, 7 months ago)
  • turbogears/controllers.py

    old new  
    528528            tgparams.update(kw) 
    529529        except AttributeError: 
    530530            raise TypeError('url() expects a dictionary for query parameters') 
    531     args = [] 
     531    args = dict() 
    532532    for key, value in tgparams.iteritems(): 
    533533        if value is None: 
    534534            continue 
     
    541541                continue 
    542542            if isinstance(v, unicode): 
    543543                v = v.encode("utf8") 
    544             args.append("%s=%s" % (k, urllib.quote(str(v)))) 
     544            args[k] = v 
    545545    if args: 
    546         result += "?" + "&".join(args
     546        result += (('?' in result) and '&' or '?') + urllib.urlencode(args, True
    547547    return result 
    548548 
    549549def check_app_root():