| | |
| | | """Generates a fully qualified URL for a named :app:`Pyramid` |
| | | :term:`route configuration`. |
| | | |
| | | .. note:: Calling :meth:`pyramid.Request.route_url` can be used to |
| | | achieve the same result as :func:`pyramid.url.route_url`. |
| | | |
| | | Use the route's ``name`` as the first positional argument. Use a |
| | | request object as the second positional argument. Additional |
| | | positional arguments are appended to the URL as path segments |
| | |
| | | If the route object which matches the ``route_name`` argument has |
| | | a :term:`pregenerator`, the ``*elements`` and ``**kw`` arguments |
| | | arguments passed to this function might be augmented or changed. |
| | | |
| | | """ |
| | | try: |
| | | reg = request.registry |
| | |
| | | ``SERVER_NAME`` in the ``request``, plus any ``SCRIPT_NAME``. The |
| | | overall result of this function is always a UTF-8 encoded string |
| | | (never Unicode). |
| | | |
| | | .. note:: Calling :meth:`pyramid.Request.model_url` can be used to |
| | | achieve the same result as :func:`pyramid.url.model_url`. |
| | | |
| | | Examples:: |
| | | |
| | |
| | | :term:`configuration declaration` or the ``<static>`` ZCML |
| | | directive (see :ref:`static_resources_section`). |
| | | |
| | | .. note:: Calling :meth:`pyramid.Request.static_url` can be used to |
| | | achieve the same result as :func:`pyramid.url.static_url`. |
| | | |
| | | Example:: |
| | | |
| | | static_url('mypackage:static/foo.css', request) => |