'Generates a fully qualified URL for a static :term:`asset`.
The asset must live within a location defined via the
:meth:`pyramid.config.Configurator.add_static_view`
:term:`configuration declaration` (see :ref:`static_assets_section`).
Example::
request.static_url(\'mypackage:static/foo.css\') =>
http://example.com/static/foo.css
The ``path`` argument points at a file or directory on disk which
a URL should be generated for.  The ``path`` may be either a
relative path (e.g. ``static/foo.css``) or an absolute path (e.g.
``/abspath/to/static/foo.css``) or a :term:`asset specification`
(e.g. ``mypackage:static/foo.css``).
The purpose of the ``**kw`` argument is the same as the purpose of
the :meth:`pyramid.request.Request.route_url` ``**kw`` argument.  See
the documentation for that function to understand the arguments which
you can provide to it.  However, typically, you don\'t need to pass
anything as ``*kw`` when generating a static asset URL.
This function raises a :exc:`ValueError` if a static view
definition cannot be found which matches the path specification.'

def static_url(self, path, **kw):

    if (not os.path.isabs(path)):
        if (':' not in path):
            package = caller_package()
            path = ('%s:%s' % (package.__name__, path))
    try:
        reg = self.registry
    except AttributeError:
        reg = get_current_registry()
    info = reg.queryUtility(IStaticURLInfo)
    if (info is None):
        raise ValueError(('No    static    URL    definition    matching    %s' % path))
    return info.generate(path, self, **kw)
