Pyramid Replacing Double Forward-Slash in URL Matchdict

后端 未结 1 1057
死守一世寂寞
死守一世寂寞 2020-12-22 01:49

Essentially, I\'m just building an API redirection route inside of Pyramid to process cross-domain AJAX requests without using JSONP.

I\'ve added a route, like so:

相关标签:
1条回答
  • 2020-12-22 02:29

    This is a fundamental limitation of any WSGI-based application. URLs are urldecoded and slashes are compacted before the URL is passed to the WSGI app. If you want to preserve the slashes you will need to urlencode them twice. AFAIK there is no way around this using a query string.

    I guess I should point out that the original URL is available, but from it you will have to parse out the part you care about yourself. It is in request.url. request.path_info is what Pyramid and most WSGI apps use to dispatch URLs because it contains only the sub-path that is relative to where the app is mounted.

    0 讨论(0)
提交回复
热议问题