'Generates a path (aka a \'relative URL\', a URL minus the host, scheme,
and port) for a static resource.
This function accepts the same argument as
:meth:`pyramid.request.Request.static_url` and performs the
same duty.  It just omits the host, port, and scheme information in
the return value; only the script_name, path, query parameters, and
anchor data are present in the returned string.
Example::
request.static_path(\'mypackage:static/foo.css\') =>
/static/foo.css
.. note::
Calling ``request.static_path(apath)`` is the same as calling
``request.static_url(apath, _app_url=request.script_name)``.
:meth:`pyramid.request.Request.static_path` is, in fact, implemented
in terms of `:meth:`pyramid.request.Request.static_url` in just this
way. As a result, any ``_app_url`` passed within the ``**kw`` values
to ``static_path`` will be ignored.'

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

    if (not os.path.isabs(path)):
        if (':' not in path):
            package = caller_package()
            path = ('%s:%s' % (package.__name__, path))
    kw['_app_url'] = self.script_name
    return self.static_url(path, **kw)
