On Dec 23, 2010, at 9:09 AM, mr.freeze wrote: > > Given this url: > URL(args=1,vars=dict(v='yes'),anchor='end') > It produces: > http://server/app/default/index/1#end?v=yes > Problem: > request.vars is empty > > This url: > http://server/app/default/index/1?v=yes#end > request.vars is populated and the anchor works > > Shouldn't the anchor be at the end of the query string? I'm running > the latest trunk.
Yes; that's an error, per RFC 3986. URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] Not only that, but '?' is legal in a fragment identifier, as is '=', so in your first example, "end?v=yes" is itself the entire (legal) anchor. I wouldn't be terribly surprised if some browsers treated this inconsistently, but we should be adhering to the RFC here. The fix looks easy; change: if anchor: other += '#' + urllib.quote(str(anchor)) if vars: other += '?%s' % m_vars to: if vars: other += '?%s' % m_vars if anchor: other += '#' + urllib.quote(str(anchor)) ...and fix the doctest. Though I'm not sure that urllib.quote is right for an anchor.