• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tags.a函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中twisted.web.template.tags.a函数的典型用法代码示例。如果您正苦于以下问题:Python a函数的具体用法?Python a怎么用?Python a使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: links

 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,代码行数:35,代码来源:server.py


示例2: render_POST

    def render_POST(self, request):
        uri = request.args.get('uri', [])
        if not uri or not tahoeRegex.match(uri[0]):
            return self.render_GET(request)
        ext = request.args.get('ext', [])

        b64uri = base64.urlsafe_b64encode(uri[0])
        extension = ''
        if ext and ext[0]:
            extension = '.' + ext[0].lstrip('.')
        if uri[0] not in self.shortdb:
            while True:
                short = crockford.b32encode(os.urandom(9)).lower()
                if short not in self.shortdb:
                    break
            self.shortdb[short] = uri[0]
            self.shortdb[uri[0]] = short
            self.shortdb.sync()
        else:
            short = self.shortdb[uri[0]]

        if request.args.get('api', []):
            return '/' + short + extension

        body = tags.p(
            tags.a('long url', href=b64uri + extension), '; ',
            tags.a('medium url', href='/' + uri[0] + extension), '; ',
            tags.a('short url', href=short + extension))
        return renderElement(request, body)
开发者ID:habnabit,项目名称:pubtahoe,代码行数:29,代码来源:pubtahoe.py


示例3: getAuthedLink

 def getAuthedLink(self, account):
     return tags.span(
         tags.a(
             tags.span(
                 account.getDisplayName(), class_="persona-link-text"),
             href="/members/account", class_="account-link"),
         " | ",
         tags.a(
             tags.span("Sign out", class_="persona-link-text"),
             href="#logout", id="persona-logout-link"),
         id="member-links")
开发者ID:mindpool,项目名称:www.mindpool.io,代码行数:11,代码来源:basefragments.py


示例4: builder_row

    def builder_row(self, bn, req, branches, num_builds):
        status = self.getStatus(req)
        builder = status.getBuilder(bn)
        state = builder.getState()[0]
        if state == 'building':
            state = 'idle'
        row = tags.tr()
        builderLink = path_to_builder(req, builder)
        row(tags.td(class_="box %s" % (state,))
                   (tags.a(href=builderLink)(bn)))

        builds = sorted([
            build for build in builder.getCurrentBuilds()
            if set(map_branches(branches)) & builder._getBuildBranches(build)
            ], key=lambda build: build.getNumber(), reverse=True)

        builds.extend(builder.generateFinishedBuilds(
            map_branches(branches), num_builds=num_builds))
        if builds:
            for b in builds:
                url = path_to_build(req, b)
                try:
                    label = b.getProperty("got_revision")
                except KeyError:
                    label = None
                # Label should never be "None", but sometimes
                # buildbot has disgusting bugs.
                if not label or label == "None" or len(str(label)) > 20:
                    label = "#%d" % b.getNumber()
                if b.isFinished():
                    text = b.getText()
                else:
                    when = b.getETA()
                    if when:
                        text = [
                            "%s" % (formatInterval(when),),
                            "%s" % (time.strftime(
                                "%H:%M:%S",
                                time.localtime(time.time() + when)),)
                        ]
                    else:
                        text = []

                row(tags.td(
                    align="center",
                    bgcolor=_backgroundColors[b.getResults()],
                    class_=("LastBuild box ", build_get_class(b)))([
                        (element, tags.br)
                        for element
                        in [tags.a(href=url)(label)] + text]))
        else:
            row(tags.td(class_="LastBuild box")("no build"))

        return row
开发者ID:ClusterHQ,项目名称:build.clusterhq.com,代码行数:54,代码来源:boxes.py


示例5: footer_right

 def footer_right(self, request, tag):
     """
     '(c) 2014-2016 ',
     tags.a('Open Hive', href='http://open-hive.org/'), ' and ',
     tags.a('Hiveeyes', href='https://hiveeyes.org/docs/system/'), '. ',
     """
     return tag(tags.p(
         'Powered by ',
         tags.a('Kotori', href='https://getkotori.org/'), ', ',
         tags.a('InfluxDB', href='https://github.com/influxdata/influxdb'), ', ',
         tags.a('dygraphs', href='http://dygraphs.com/'), ' and ',
         tags.a('DataTables', href='https://datatables.net/'), '.'
     ))
开发者ID:hiveeyes,项目名称:kotori,代码行数:13,代码来源:html.py


示例6: generateTabsAndContent

        def generateTabsAndContent(results):
            """
            results is a dictionary whose keys are normalized ASCII chars and
            whose values are the original (possible unicode) chars that map to
            the ASCII ones.
            """
            tabs = []
            contents = []
            for asciiLetter in sorted(results.keys()):
                if not asciiLetter:
                    continue
                for letter in sorted(results[asciiLetter]):
                    tab = tags.li(
                        tags.a(
                            letter.upper(),
                            href="#l%s" % letter,
                            **{"data-toggle": "tab"})
                        )
                    tabs.append(tab)
                    content = tags.div(
                        tags.p("holding content"),
                        class_="tab-pane",
                        id="l%s" % letter)
                    contents.append(content)

            return tags.div(
                tags.ul(tabs, class_="nav nav-tabs"),
                tags.div(contents, class_="tab-content"),
                class_="tabbable tabs-left")
开发者ID:oubiwann,项目名称:tharsk,代码行数:29,代码来源:elements.py


示例7: getSignInLink

 def getSignInLink(self):
     return tags.span(
         tags.a(
             tags.span("Persona Sign-in", class_="persona-link-text"),
             href="#login", id="persona-login-link",
             class_="persona-button dark"),
         id="persona-login")
开发者ID:mindpool,项目名称:www.mindpool.io,代码行数:7,代码来源:basefragments.py


示例8: formatPrincipals

def formatPrincipals(principals):
    """
    Format a list of principals into some twisted.web.template DOM objects.
    """
    def recordKey(principal):
        try:
            record = principal.record
        except AttributeError:
            try:
                record = principal.parent.record
            except:
                return None
        return (record.recordType, record.shortNames[0])


    def describe(principal):
        if hasattr(principal, "record"):
            return " - %s" % (principal.record.fullName,)
        else:
            return ""

    return formatList(
        tags.a(href=principal.principalURL())(
            str(principal), describe(principal)
        )
        for principal in sorted(principals, key=recordKey)
    )
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:27,代码来源:principal.py


示例9: getCopyright

 def getCopyright(self):
     year = meta.startingYear
     thisYear = datetime.now().year
     mailTo = "mailto:%s" % config.salesEmail
     if thisYear > year:
         year = "%s - %s" % (year, thisYear)
     return ("© %s " % year, tags.a(meta.author, href=mailTo))
开发者ID:mindpool,项目名称:www.mindpool.io,代码行数:7,代码来源:fragments.py


示例10: _showDirectory

 def _showDirectory(self, request, dirinfo):
     children = dirinfo[1]['children']
     body = tags.ul(*[
         tags.li(tags.a(name + ('/' if info[0] == 'dirnode' else ''),
                        href='/' + info[1]['ro_uri']))
         for name, info in children.iteritems()
     ])
     renderElement(request, body)
开发者ID:habnabit,项目名称:pubtahoe,代码行数:8,代码来源:pubtahoe.py


示例11: hist

 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,代码行数:8,代码来源:server.py


示例12: stanForOb

 def stanForOb(self, ob, summary=False):
     current_docstring = self.currentDocstringForObject(ob)
     if summary:
         return epydoc2stan.doc2stan(
             ob.doctarget, summary=True,
             docstring=current_docstring)[0]
     r = [tags.div(epydoc2stan.doc2stan(ob.doctarget,
                                        docstring=current_docstring)[0]),
          tags.a(href="edit?ob="+ob.fullName())("Edit"),
          " "]
     if ob.doctarget in self.editsbyob:
         r.append(tags.a(href="history?ob="+ob.fullName())(
             "View docstring history (",
             str(len(self.editsbyob[ob.doctarget])),
             " versions)"))
     else:
         r.append(tags.span(class_='undocumented')("No edits yet."))
     return r
开发者ID:chevah,项目名称:pydoctor,代码行数:18,代码来源:server.py


示例13: lineno

 def lineno(self, request, tag):
     if not self.has_lineno_col:
         return ()
     if hasattr(self.child, 'linenumber'):
         line = str(self.child.linenumber)
         if self.child.sourceHref:
             line = tags.a(href=self.child.sourceHref)(line)
         return tag.clear()(line)
     else:
         return ()
开发者ID:chevah,项目名称:pydoctor,代码行数:10,代码来源:table.py


示例14: getDropdown

 def getDropdown(self, title, url, cssClass):
     elements = []
     if title == "About":
         links = urls.aboutDropDown
     for text, url, type in links:
         if type == const.DIVIDER:
             element = tags.li(class_="divider")
         elif type == const.HEADER:
             element = tags.li(text, class_="nav-header")
         else:
             element = tags.li(tags.a(text, href=url))
         elements.append(element)
     return tags.li(
         tags.a(
             title, tags.b(class_="caret"),
             href="#", class_="dropdown-toggle",
             **{"data-toggle": "dropdown"}),
         tags.ul(elements, class_="dropdown-menu"),
         class_=cssClass)
开发者ID:mindpool,项目名称:www.mindpool.io,代码行数:19,代码来源:basefragments.py


示例15: from_dashboard

    def from_dashboard(cls, dashboard):
        url = '/%s' % (dashboard.config['name'])

        if 'share_id' in dashboard.config:
            shared_url = '/shared/%s' % dashboard.config['share_id']
            shared_url_tag = tags.a(shared_url, href=shared_url)
        else:
            shared_url_tag = ''

        return cls(dashboard.config['title'], url, shared_url_tag)
开发者ID:praekelt,项目名称:diamondash,代码行数:10,代码来源:server.py


示例16: maybeShortenList

def maybeShortenList(system, label, lst, idbase):
    lst2 = []
    for name in lst:
        o = system.allobjects.get(name)
        if o is None or o.isVisible:
            lst2.append(name)
    lst = lst2
    if not lst:
        return None
    def one(item):
        if item in system.allobjects:
            return taglink(system.allobjects[item])
        else:
            return item
    def commasep(items):
        r = []
        for item in items:
            r.append(one(item))
            r.append(', ')
        del r[-1]
        return r
    p = [label]
    if len(lst) <= 5 or not system.options.htmlshortenlists:
        p.extend(commasep(lst))
    else:
        p.extend(commasep(lst[:3]))
        q = [', ']
        q.extend(commasep(lst[3:]))
        q.append(tags.span(class_='showIfJS')[
            ' ',
            tags.a(href="#",
                   onclick="showAndHide('%s');"%idbase,
                   class_="jslink")
            ['(hide last %d again)'%len(lst[3:])]])
        p.append(tags.span(id=idbase, class_='hideIfJS')[q])
        p.append(tags.span(id=idbase+'Link', class_='showIfJS')[
            ' ',
            tags.a(href="#",
                   onclick="hideAndShow('%s');"%idbase,
                   class_="jslink")
            ['... and %d more'%len(lst[3:])]])
    return p
开发者ID:chevah,项目名称:pydoctor,代码行数:42,代码来源:__init__.py


示例17: render_GET

    def render_GET(self, request):
        applications = []
        for app in self.registry.applications.values():
            link = tags.a(tags.tt(app.name), ' at ', tags.tt(app.path.path),
                          href=app.name)
            applications.append(tags.li(link))

        body = tags.body(
            tags.p('Here are your applications:'),
            tags.ul(*applications))
        return renderElement(request, body)
开发者ID:eevee,项目名称:mamayo,代码行数:11,代码来源:status.py


示例18: letterlinks

 def letterlinks(self, request, tag):
     letterlinks = []
     for initial in sorted(self.initials):
         if initial == self.my_letter:
             letterlinks.append(initial)
         else:
             letterlinks.append(tags.a(href='#'+initial)(initial))
         letterlinks.append(' - ')
     if letterlinks:
         del letterlinks[-1]
     return tag(letterlinks)
开发者ID:pombredanne,项目名称:pydoctor,代码行数:11,代码来源:summary.py


示例19: dictionaries

 def dictionaries(self, request, tag):
     """
     """
     elements = []
     for dictionary in const.dictionaries:
         name = utils.getDictionaryName(dictionary)
         url = const.urls["dictionary"].replace(
             const.urlParams["dictionary"], dictionary)
         elements.append(
             tags.li(tags.a(name, href=url)))
     return tag(elements)
开发者ID:oubiwann,项目名称:tharsk,代码行数:11,代码来源:elements.py


示例20: test_serializedAttributeWithTagWithAttribute

    def test_serializedAttributeWithTagWithAttribute(self):
        """
        Similar to L{test_serializedAttributeWithTag}, but for the additional
        complexity where the tag which is the attribute value itself has an
        attribute value which contains bytes which require substitution.
        """
        flattened = self.assertFlattensImmediately(
            tags.img(src=tags.a(href='<>&"')),
            '<img src="&lt;a href=' "&quot;&amp;lt;&amp;gt;&amp;amp;&amp;quot;&quot;&gt;" '&lt;/a&gt;" />',
        )

        # As in checkTagAttributeSerialization, belt-and-suspenders:
        self.assertXMLEqual(XML(flattened).attrib["src"], '<a href="&lt;&gt;&amp;&quot;"></a>')
开发者ID:vmarkovtsev,项目名称:twisted,代码行数:13,代码来源:test_flatten.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tags.div函数代码示例发布时间:2022-05-27
下一篇:
Python template.Element类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap