pyramid.url¶
Utility functions for dealing with URLs in pyramid
- resource_url(resource, request, *elements, **kw)[ソース]¶
This is a backwards compatibility function. Its result is the same as calling:
request.resource_url(resource, *elements, **kw)
See
pyramid.request.Request.resource_url()for more information.
- route_url(route_name, request, *elements, **kw)[ソース]¶
This is a backwards compatibility function. Its result is the same as calling:
request.route_url(route_name, *elements, **kw)
See
pyramid.request.Request.route_url()for more information.
- current_route_url(request, *elements, **kw)[ソース]¶
This is a backwards compatibility function. Its result is the same as calling:
request.current_route_url(*elements, **kw)
See
pyramid.request.Request.current_route_url()for more information.
- route_path(route_name, request, *elements, **kw)[ソース]¶
This is a backwards compatibility function. Its result is the same as calling:
request.route_path(route_name, *elements, **kw)
See
pyramid.request.Request.route_path()for more information.
- current_route_path(request, *elements, **kw)[ソース]¶
This is a backwards compatibility function. Its result is the same as calling:
request.current_route_path(*elements, **kw)
See
pyramid.request.Request.current_route_path()for more information.
- static_url(path, request, **kw)[ソース]¶
This is a backwards compatibility function. Its result is the same as calling:
request.static_url(path, **kw)
See
pyramid.request.Request.static_url()for more information.
- static_path(path, request, **kw)[ソース]¶
This is a backwards compatibility function. Its result is the same as calling:
request.static_path(path, **kw)
See
pyramid.request.Request.static_path()for more information.
- urlencode(query, doseq=True, quote_via=<function quote_plus>)[ソース]¶
An alternate implementation of Python's stdlib
urllib.parse.urlencode()function which accepts string keys and values within thequerydict/sequence; all string keys and values are first converted to UTF-8 before being used to compose the query string.The value of
querymust be a sequence of two-tuples representing key/value pairs or an object (often a dictionary) with an.items()method that returns a sequence of two-tuples representing key/value pairs.For minimal calling convention backwards compatibility, this version of urlencode accepts but ignores a second argument conventionally named
doseq. The Python stdlib version behaves differently whendoseqis False and when a sequence is presented as one of the values. This version always behaves in thedoseq=Truemode, no matter what the value of the second argument.Both the key and value are encoded using the
quote_viafunction which by default is using a similar algorithm tourllib.parse.quote_plus()which converts spaces into '+' characters and '/' into '%2F'.バージョン 1.5 で変更: In a key/value pair, if the value is
Nonethen it will be dropped from the resulting output.バージョン 1.9 で変更: Added the
quote_viaargument to allow alternate quoting algorithms to be used.