web.ctx.homepath + web.ctx.fullpath



ctx.homedomain = ctx.protocol + '://' + env.get('HTTP_HOST', '[unknown]')
ctx.homepath = os.environ.get('REAL_SCRIPT_NAME', env.get('SCRIPT_NAME', ''))
ctx.home = ctx.homedomain + ctx.homepath
ctx.realhome = ctx.home
ctx.ip = env.get('REMOTE_ADDR')
ctx.method = env.get('REQUEST_METHOD')
ctx.path = env.get('PATH_INFO')
# http://trac.lighttpd.net/trac/ticket/406 requires:
if env.get('SERVER_SOFTWARE', '').startswith('lighttpd/'):
    ctx.path = lstrips(env.get('REQUEST_URI').split('?')[0], ctx.homepath)
    # Apache and CherryPy webservers unquote the url but lighttpd doesn't. 
    # unquote explicitly for lighttpd to make ctx.path uniform across all servers.
    ctx.path = urllib.unquote(ctx.path)

if env.get('QUERY_STRING'):
    ctx.query = '?' + env.get('QUERY_STRING', '')
    ctx.query = ''

ctx.fullpath = ctx.path + ctx.query


def _delegate_sub_application(self, dir, app):
    """Deletes request to sub application `app` rooted at the directory `dir`.
    The home, homepath, path and fullpath values in web.ctx are updated to mimic request
    to the subapp and are restored after it is handled. 

    Any issues with when used with yield?
    web.ctx._oldctx = web.storage(web.ctx)
    web.ctx.home += dir
    web.ctx.homepath += dir
    web.ctx.path = web.ctx.path[len(dir):]
    web.ctx.fullpath = web.ctx.fullpath[len(dir):]
    return app.handle_with_processors()
This entry was posted in Python and tagged , . Bookmark the permalink.


电子邮件地址不会被公开。 必填项已用 * 标注


您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>