MCPcopy
hub / github.com/Pylons/pyramid / current_route_path

Method current_route_path

src/pyramid/url.py:749–780  ·  view source on GitHub ↗

Generates a path (aka a 'relative URL', a URL minus the host, scheme, and port) for the :app:`Pyramid` :term:`route configuration` matched by the current request. This function accepts the same argument as :meth:`pyramid.request.Request.current_route_url` an

(self, *elements, **kw)

Source from the content-addressed store, hash-verified

747 return self.route_url(route_name, *elements, **newkw)
748
749 def current_route_path(self, *elements, **kw):
750 """
751 Generates a path (aka a 'relative URL', a URL minus the host, scheme,
752 and port) for the :app:`Pyramid` :term:`route configuration` matched
753 by the current request.
754
755 This function accepts the same argument as
756 :meth:`pyramid.request.Request.current_route_url` and performs the
757 same duty. It just omits the host, port, and scheme information in
758 the return value; only the script_name, path, query parameters, and
759 anchor data are present in the returned string.
760
761 For example, if the route matched by the current request has the
762 pattern ``/{foo}/{bar}``, this call to ``current_route_path``::
763
764 request.current_route_path(foo='1', bar='2')
765
766 Will return the string ``/1/2``.
767
768 .. note::
769
770 Calling ``request.current_route_path('route')`` is the same
771 as calling ``request.current_route_url('route',
772 _app_url=request.script_name)``.
773 :meth:`pyramid.request.Request.current_route_path` is, in fact,
774 implemented in terms of
775 :meth:`pyramid.request.Request.current_route_url` in just this
776 way. As a result, any ``_app_url`` passed within the ``**kw``
777 values to ``current_route_path`` will be ignored.
778 """
779 kw['_app_url'] = self.script_name
780 return self.current_route_url(*elements, **kw)
781
782
783def route_url(route_name, request, *elements, **kw):

Callers 1

current_route_pathFunction · 0.45

Calls 1

current_route_urlMethod · 0.95

Tested by

no test coverage detected