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

Python tags.span函数代码示例

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

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



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

示例1: render

 def render(self, data):
     r = []
     i = 0
     vlanlist = []
     notpresent = T.td(_class="notpresent")[
         T.acronym(title="Not present or no information from remote")["N/A"]]
     for row in data:
         if row[1] is not None:
             vlanlist.append(str(row[0]))
         vid = T.td[T.span(data=row[0], render=T.directive("vlan"))]
         if row[1] is None:
             r.append(T.tr(_class=(i%2) and "odd" or "even")[
                     vid, notpresent,
                     T.td[row[2]]])
         elif row[2] is None:
             r.append(T.tr(_class=(i%2) and "odd" or "even")
                      [vid, T.td[row[1]], notpresent])
         elif row[1] == row[2]:
             r.append(T.tr(_class=(i%2) and "odd" or "even")
                      [vid, T.td(colspan=2)[row[1]]])
         else:
             r.append(T.tr(_class=(i%2) and "odd" or "even")
                      [vid, T.td[row[1]], T.td[row[2]]])
         i += 1
     vlantable = T.table(_class="vlan")[
         T.thead[T.td["VID"], T.td["Local"], T.td["Remote"]], r]
     return [('VLAN',
              [[ [T.span(data=v, render=T.directive("vlan")), " "]
                 for v in vlanlist ],
               T.span(render=T.directive("tooltip"),
                      data=vlantable)],
              ", ".join(vlanlist))]
开发者ID:GennadySpb,项目名称:wiremaps,代码行数:32,代码来源:ports.py


示例2: test_authenticatedApplicationNavigation

    def test_authenticatedApplicationNavigation(self):
        """
        The I{applicationNavigation} renderer should add primary navigation
        elements to the tag it is passed if it is called on a
        L{_PublicPageMixin} being rendered for an authenticated user.
        """
        navigable = FakeNavigableElement(store=self.userStore)
        installOn(navigable, self.userStore)
        navigable.tabs = [Tab('foo', 123, 0, [Tab('bar', 432, 0)])]
        request = FakeRequest()

        page = self.createPage(self.username)
        navigationPattern = div[
            span(id='app-tab', pattern='app-tab'),
            span(id='tab-contents', pattern='tab-contents')]
        ctx = context.WebContext(tag=navigationPattern)
        ctx.remember(request)
        tag = page.render_applicationNavigation(ctx, None)
        self.assertEqual(tag.tagName, 'div')
        self.assertEqual(tag.attributes, {})
        children = [child for child in tag.children if child.pattern is None]
        self.assertEqual(children, [])
        self.assertEqual(len(tag.slotData['tabs']), 1)
        fooTab = tag.slotData['tabs'][0]
        self.assertEqual(fooTab.attributes, {'id': 'app-tab'})
        self.assertEqual(fooTab.slotData['name'], 'foo')
        fooContent = fooTab.slotData['tab-contents']
        self.assertEqual(fooContent.attributes, {'id': 'tab-contents'})
        self.assertEqual(
            fooContent.slotData['href'], self.privateApp.linkTo(123))
开发者ID:rcarmo,项目名称:divmod.org,代码行数:30,代码来源:test_publicweb.py


示例3: test_authenticatedApplicationNavigation

    def test_authenticatedApplicationNavigation(self):
        """
        The I{applicationNavigation} renderer should add primary navigation
        elements to the tag it is passed if it is called on a
        L{_PublicPageMixin} being rendered for an authenticated user.
        """
        navigable = FakeNavigableElement(store=self.userStore)
        installOn(navigable, self.userStore)
        navigable.tabs = [Tab("foo", 123, 0, [Tab("bar", 432, 0)])]
        request = FakeRequest()

        page = self.createPage(self.username)
        navigationPattern = div[span(id="app-tab", pattern="app-tab"), span(id="tab-contents", pattern="tab-contents")]
        ctx = context.WebContext(tag=navigationPattern)
        ctx.remember(request)
        tag = page.render_applicationNavigation(ctx, None)
        self.assertEqual(tag.tagName, "div")
        self.assertEqual(tag.attributes, {})
        children = [child for child in tag.children if child.pattern is None]
        self.assertEqual(children, [])
        self.assertEqual(len(tag.slotData["tabs"]), 1)
        fooTab = tag.slotData["tabs"][0]
        self.assertEqual(fooTab.attributes, {"id": "app-tab"})
        self.assertEqual(fooTab.slotData["name"], "foo")
        fooContent = fooTab.slotData["tab-contents"]
        self.assertEqual(fooContent.attributes, {"id": "tab-contents"})
        self.assertEqual(fooContent.slotData["href"], self.privateApp.linkTo(123))
开发者ID:fusionapp,项目名称:mantissa,代码行数:27,代码来源:test_publicweb.py


示例4: render_discovery

 def render_discovery(self, ctx, data):
     if not data:
         return ctx.tag["This hostname has not been seen with %s." % self.protocolname]
     return ctx.tag["This hostname has been seen with %s: " % self.protocolname,
                    T.ul[ [ T.li [
                 "from port ",
                 T.span(_class="data") [d[1]],
                 " of ",
                 T.span(data=d[0],
                        render=T.directive("hostname")) ]  for d in data ] ] ]
开发者ID:GennadySpb,项目名称:wiremaps,代码行数:10,代码来源:search.py


示例5: render_description

 def render_description(self, ctx, data):
     if not data:
         return ctx.tag["Nothing was found in descriptions"]
     return ctx.tag["The following descriptions match the request:",
                    T.ul[ [ T.li [
                 T.span(_class="data") [d[1]],
                 " from ",
                 T.span(data=d[0],
                        render=T.directive("hostname")), "." ]
                            for d in data ] ] ]
开发者ID:GennadySpb,项目名称:wiremaps,代码行数:10,代码来源:search.py


示例6: addTickAtTime

 def addTickAtTime(self, t):
     dt = datetime.fromtimestamp(t)
     label = [T.span(class_="date")[dt.strftime("%Y-")],
              (T.span(class_="date")[dt.strftime("%m-%d")], T.br),
              dt.strftime("%H:%M")]
     visibleLabel = differentSuffix(label, self.prevLabel, key=str)
     self.output.append(
         T.div(class_="abs timeline-timeLabel",
               style=("left: %spx; top: 50px; height: 50px;" %
                      xPx(t)))[visibleLabel])
     self.prevLabel = label
开发者ID:drewp,项目名称:room,代码行数:11,代码来源:stripchart.py


示例7: render_sonmp

 def render_sonmp(self, ctx, data):
     if not data:
         return ctx.tag["This IP has not been seen with SONMP."]
     return ctx.tag["This IP has been seen with SONMP: ",
                    T.ul[ [ T.li [
                 "from port ",
                 T.span(_class="data") [d[1]],
                 " of ",
                 T.span(data=d[0],
                        render=T.directive("hostname")),
                 " connected to port ",
                 T.span(data=d[2], _class="data",
                        render=T.directive("sonmpport")) ] for d in data] ] ]
开发者ID:GennadySpb,项目名称:wiremaps,代码行数:13,代码来源:search.py


示例8: render_ipeqt

 def render_ipeqt(self, ctx, data):
     if not data:
         return ctx.tag["The IP ",
                        T.span(data=self.ip,
                               render=T.directive("ip")),
                        " is not owned by a known equipment."]
     return ctx.tag["The IP ",
                    T.span(data=self.ip,
                           render=T.directive("ip")),
                    " belongs to ",
                    T.span(data=data[0][0],
                           render=T.directive("hostname")),
                    "."]
开发者ID:GennadySpb,项目名称:wiremaps,代码行数:13,代码来源:search.py


示例9: _renderPage

        def _renderPage():
            page = MantissaLivePage(FakeWebSite())
            element = LiveElement(stan(tags.span(render=tags.directive('liveElement'))))
            element.setFragmentParent(page)
            element.jsClass = u'Mantissa.Test.Dummy.DummyWidget'
            page.docFactory = stan([tags.span(render=tags.directive('liveglue')), element])

            ctx = WovenContext()
            req = FakeRequest(headers={'host': self.hostname})
            ctx.remember(req, IRequest)
            page.beforeRender(ctx)
            page.renderHTTP(ctx)
            page._messageDeliverer.close()
开发者ID:twisted,项目名称:mantissa,代码行数:13,代码来源:test_website.py


示例10: render_comment

 def render_comment(self, ctx, comment):
     tag = ctx.tag
     tag.fillSlots("id", comment.id)
     tag.fillSlots("posted", comment.posted)
     tag.fillSlots("authorName", comment.authorName)
     if comment.authorName == 'David Ward':
         tag.fillSlots("isOwner", 'owner')
     else:
         tag.fillSlots("isOwner", '')
     tag.fillSlots("authorEmail", comment.authorEmail)
     tag.fillSlots("comment", T.xml(markdown.markdown(comment.comment)))
     tag.fillSlots("relatesToCommentId",comment.relatesToCommentId)
     if hasattr(comment, 'relatesToComment') and comment.relatesToComment is not None:
         tag.fillSlots("relatesToCommentName",comment.relatesToComment.authorName)
     else:
         tag.fillSlots("relatesToCommentName",'main blog entry')
     if hasattr(comment,'followUpComments') and comment.followUpComments is not None:
         fTag = T.span(class_='followUps')
         for f in comment.followUpComments:
             fTag[ T.a(href="#comment-%s"%f.id,rel='inspires')[ f.authorName ],', ' ]
         tag.fillSlots("followUpComments",fTag)
     else:
         tag.fillSlots("followUpComments",'None')
         
     return tag
开发者ID:timparkin,项目名称:into-the-light,代码行数:25,代码来源:blog.py


示例11: render_listsheets

    def render_listsheets(self,ctx):

        return [T.div[
            T.span(style="font-weight:bold;")[
            T.a(href=i[0])[i[1]]],' located at ',
            T.a(href=i[0])[i[0]]
            ] for i in self.emailInfo]
开发者ID:comfuture,项目名称:numbler,代码行数:7,代码来源:invite.py


示例12: render_index_players

    def render_index_players(self, ctx, data):
        data.sort(key=attrgetter('name'))
        lines = []
        for player in data:
            line = []
            name = player.name
            tzid = player.tzid
            tzidcell = T.td(_class="objtzid")[tzid, ':']
            line.append(tzidcell)


            if admin.verify(player):
                line.append(T.td['!'])
            elif wizard.verify(player):
                line.append(T.td['@'])
            else:
                line.append(T.td)

            editlink = T.a(href="/edit/%s" % tzid)[name]
            line.append(T.td(_class="objname")[editlink])

            if player.logged_in:
                room = player.room
                editlink = "/edit/%s" % room.tzid
                link = T.a(href=editlink)[T.span(_class="editlink")[room.name]]
                line.append(T.td[link])
            else:
                line.append(T.td)

            lines.append(T.tr[line])

        return T.table[lines]
开发者ID:cryptixman,项目名称:tzmud,代码行数:32,代码来源:pages_index.py


示例13: gotProducts

 def gotProducts(products):
     htmlblock = []
     for n,product in enumerate(products):
         column = divmod(n,3)[1]+1
         name = product.code
         title = product.title
         shortDescription = product.summary
         imgsrc='/system/ecommerce/%s/mainImage?size=190x300&sharpen=1.0x0.5%%2b0.8%%2b0.1'%product.id
         
         html = T.div(class_='category c%s'%column)[
             T.a(href=url.here.child(name))[
                 T.img(src=imgsrc,width=190),T.span(class_='mbf-item')['#gallery %s'%product.code]
                 ],
             T.h4[
                 T.a(href=url.here.child(name))[
                     title
                     ]
                 ],
             T.p[
                 T.a(href=url.here.child(name))[
                     shortDescription
                 ]
             ]
         ]
         htmlblock.append(html)
         # Group the output into threes
         if column == 3:
             out = htmlblock
             htmlblock = []
             yield T.div(class_="threecolumnleft clearfix")[ out ]
     # and then yield anything left over if the last item wasn't at the end of a row
     if column != 3:
         yield T.div(class_="threecolumnleft clearfix")[ htmlblock ]
开发者ID:timparkin,项目名称:into-the-light,代码行数:33,代码来源:gallery.py


示例14: rend

    def rend(self, context, data):
        defaults = context.locate(iformless.IFormDefaults)
        value = defaults.getDefault(context.key, context)
        context.remember(data.typedValue, iformless.ITyped)

        if data.typedValue.getAttribute('immutable'):
            inp = tags.span(id=keyToXMLID(context.key))[value]
        else:
            ##value may be a deferred; make sure to wait on it properly before calling self.input
            ## TODO: If flattening this results in an empty string, return an empty string
            inp = tags.invisible(
                render=lambda c, value: self.input( context, tags.invisible(), data, data.name, value ),
                data=value)

        if data.typedValue.getAttribute('hidden') or data.typedValue.getAttribute('compact'):
            return inp

        context.fillSlots( 'label', data.label )
        context.fillSlots( 'name', data.name )
        context.fillSlots( 'input', inp )
        context.fillSlots( 'error', getError(context) )
        context.fillSlots( 'description', data.description )
        context.fillSlots( 'id', keyToXMLID(context.key) )
        context.fillSlots( 'value', value )

        return context.tag
开发者ID:StetHD,项目名称:nevow,代码行数:26,代码来源:webform.py


示例15: test_patterned

 def test_patterned(self):
     """Test fetching a specific part (a pattern) of the document.
     """
     doc = t.div[t.p[t.span(pattern='inner')['something']]]
     df = loaders.stan(doc, pattern='inner')
     self.assertEquals(df.load()[0].tagName, 'span')
     self.assertEquals(df.load()[0].children[0], 'something')
开发者ID:StetHD,项目名称:nevow,代码行数:7,代码来源:test_loaders.py


示例16: test_nested_data

 def test_nested_data(self):
     def checkContext(ctx, data):
         self.assertEqual(data, "inner")
         self.assertEqual(ctx.locate(inevow.IData, depth=2), "outer")
         return 'Hi'
     tag = tags.html(data="outer")[tags.span(render=lambda ctx,data: ctx.tag, data="inner")[checkContext]]
     self.assertEqual(self.render(tag), "<html><span>Hi</span></html>")
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:7,代码来源:test_flatstan.py


示例17: workloadTypeList

 def workloadTypeList(self, ctx):
     session = inevow.ISession(ctx) 
     wltTable = WorkloadTypeTable(self, session.uid)
     
     if self.workloadTypes is None:
         self.workloadTypes = yield session.agent.expsvcAgent.getWorkloadTypes(agentId = self.agentId)
     
     self.workloadClasses = ['CPU', 'MEM', 'DISK', 'FS', 'NET', 'OS']
     
     for wltypeName, wltype in self.workloadTypes.iteritems():
         wlcTags = [T.span(_class='badge', 
                           title = wlclasses[wlc][1])[
                                                      wlclasses[wlc][0]]
                    for wlc 
                    in wltype.wlclass]
         rawClasses = set(wlclasses[wlc][0] for wlc in wltype.wlclass)
         
         wltTable.add({'module': wltype.module,
                       'workload': wltypeName,
                       # url.gethere doesn't work here because when liveglue updates page
                       # all links become broken. 
                       'wltHref': url.URL.fromContext(ctx).add('wlt', wltypeName),
                       'classes': wlcTags,
                       'rawClasses': rawClasses})
     
     wltTable.setPage(0)
     self.wltTable = wltTable
     
     returnValue(wltTable)
开发者ID:myaut,项目名称:tsload,代码行数:29,代码来源:agent.py


示例18: setUp

 def setUp(self):
     self.d = Deferred()
     self.d2 = Deferred()
     self.r = rend.Page(docFactory=loaders.stan(
         tags.html(data=self.data_later)[
             'Hello ', str, ' and '
             'goodbye ',str,
             tags.span(data=self.data_later2, render=str)]))
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:8,代码来源:test_later.py


示例19: rend

 def rend(self, ctx, data):
     return (tags.span(
         _class="collapser-line",
         onclick=(
             "collapse(this, '",
             self.headCollapsed,
             "', '",
             self.headExpanded,
             "');"))[
         tags.img(_class="visibilityImage", src="/images/outline-%s.png" % self.collapsed),
         tags.span(_class="headText", style="color: blue; text-decoration: underline; cursor: pointer;")[
             self.collapsed == 'collapsed' and self.headCollapsed or self.headExpanded ]
     ],
     tags.xml('&nbsp;'),
     tags.div(_class=self.collapsed)[
         self.body
     ])
开发者ID:StetHD,项目名称:nevow,代码行数:17,代码来源:blocks.py


示例20: render_sample

 def render_sample(self, context, data):
     request = inevow.IRequest(context)
     session = inevow.ISession(context)
     count = getattr(session, 'count', 1)
     session.count = count + 1
     return ["Welcome, person from ", request.client.host, "! You are using ",
         request.getHeader('user-agent'), " and have been here ", 
         T.span(id="count")[count], " times."]
开发者ID:StetHD,项目名称:nevow,代码行数:8,代码来源:simple.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python tags.table函数代码示例发布时间:2022-05-27
下一篇:
Python tags.slot函数代码示例发布时间: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