Pyramid only generates urls in the format <scheme>://<host>:<port>/<script_name>/<path_info>?<query>#<anchor>. Your proposed scheme is attempting to marshal all of the data through the anchor. The general idea of such a url that puts the query string in the anchor is to hide that data from the server (anchors are not sent along with requests, they are only used by the user agent).
You probably want to define a function that builds an anchor and then you can pass it in as the _anchor value to request.route_url. The only trick there is to know that pyramid will url-quote that value, so you'll want to pass in an unquoted value.
def make_anchor(path, args):
return ...
request.route_url(..., _anchor=make_anchor(...))
If you're feeling fancy you can even do this with a pregenerator on the route that you want this to work for which could take kwargs passed to route_url and convert them into an _anchor argument under the hood. This way you could do things like request.route_url(..., arg1='foo', arg2='bar') and the pregenerator could strip arg1/arg2 and convert them to an _anchor kwarg.
- Michael