当前位置: 首页>>代码示例>>Python>>正文


Python URLPath.fromRequest方法代码示例

本文整理汇总了Python中twisted.python.urlpath.URLPath.fromRequest方法的典型用法代码示例。如果您正苦于以下问题:Python URLPath.fromRequest方法的具体用法?Python URLPath.fromRequest怎么用?Python URLPath.fromRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.python.urlpath.URLPath的用法示例。


在下文中一共展示了URLPath.fromRequest方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: links

# 需要导入模块: from twisted.python.urlpath import URLPath [as 别名]
# 或者: from twisted.python.urlpath.URLPath import fromRequest [as 别名]
 def links(self, request, tag):
     ds = self.root.edits(self.ob)
     therange = range(len(ds))
     rev = therange[self.rev]
     ul = tags.ul()
     for i in therange:
         li = tags.li()
         if i:
             u = URLPath.fromRequest(request)
             u = u.sibling('diff')
             u.query = urllib.urlencode({
                 'ob': self.ob.fullName(),
                 'revA': i-1,
                 'revB': i,
                 })
             li(tags.a(href=str(u))("(diff)"))
         else:
             li("(diff)")
         li(" - ")
         if i == len(ds) - 1:
             label = "Latest"
         else:
             label = str(i)
         if i == rev:
             li(label)
         else:
             u = URLPath.fromRequest(request)
             u.query = urllib.urlencode({
                 'rev': str(i),
                 'ob': self.ob.fullName(),
                 })
             li(tags.a(href=str(u))(label))
         li(' - ' + ds[i].user + '/' + ds[i].time)
         ul(li)
     return tag(ul)
开发者ID:chevah,项目名称:pydoctor,代码行数:37,代码来源:server.py

示例2: hist

# 需要导入模块: from twisted.python.urlpath import URLPath [as 别名]
# 或者: from twisted.python.urlpath.URLPath import fromRequest [as 别名]
 def hist(self, data, request):
     u = URLPath.fromRequest(request)
     u = u.sibling('diff')
     u.query = urllib.urlencode({
         'ob': data.obj.fullName(),
         'rev': data.rev,
         })
     return tags.a(href=str(u))("(hist)")
开发者ID:chevah,项目名称:pydoctor,代码行数:10,代码来源:server.py

示例3: base_uri_from_request

# 需要导入模块: from twisted.python.urlpath import URLPath [as 别名]
# 或者: from twisted.python.urlpath.URLPath import fromRequest [as 别名]
def base_uri_from_request(request):
    """
    Given a request, return the base URI of the request

    :param request: a twisted HTTP request
    :type request: :class:`twisted.web.http.Request`

    :return: the base uri the request was trying to access
    :rtype: ``str``
    """
    return str(URLPath.fromRequest(request).click(b'/'))
开发者ID:pratikmallya,项目名称:mimic,代码行数:13,代码来源:identity_api.py

示例4: absoluteURL

# 需要导入模块: from twisted.python.urlpath import URLPath [as 别名]
# 或者: from twisted.python.urlpath.URLPath import fromRequest [as 别名]
def absoluteURL(request, ob):
    if ob.documentation_location == model.DocLocation.PARENT_PAGE:
        p = ob.parent
        if isinstance(p, model.Module) and p.name == '__init__':
            p = p.parent
        child = p.fullName() + '.html'
        frag = ob.name
    elif ob.documentation_location == model.DocLocation.OWN_PAGE:
        child = ob.fullName() + '.html'
        frag = None
    else:
        raise AssertionError("XXX")
    u = URLPath.fromRequest(request)
    u = u.sibling(child)
    u.query = ''
    u.fragment = frag
    return str(u)
开发者ID:chevah,项目名称:pydoctor,代码行数:19,代码来源:server.py

示例5: URLPath

# 需要导入模块: from twisted.python.urlpath import URLPath [as 别名]
# 或者: from twisted.python.urlpath.URLPath import fromRequest [as 别名]
 def URLPath(self):
     return URLPath.fromRequest(self)
开发者ID:fusionapp,项目名称:fusion-index,代码行数:4,代码来源:util.py


注:本文中的twisted.python.urlpath.URLPath.fromRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。