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

Python tags.div函数代码示例

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

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



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

示例1: render_footer

 def render_footer(self, context, data):
     return  tags.p() [
             tags.div()['Lumen is running on port %s' % lumen.config['port']],
             tags.div()[
                 tags.a(href='http://github.com/unsouled/lumen')['Github']
             ]
     ]
开发者ID:unsouled,项目名称:lumen,代码行数:7,代码来源:webconsole.py


示例2: render_content

	def render_content(self, ctx, data):
		request = inevow.IRequest(ctx)
		
		ctx.fillSlots('header_bar', self.anon_header) 
		ctx.fillSlots('top_bar', T.div(id="top_bar"))
		ctx.fillSlots('main_content', loaders.stan(T.div(id="manager_hook")))
		return ctx.tag
开发者ID:BGCX261,项目名称:zoto-server-svn-to-git,代码行数:7,代码来源:reset_password.py


示例3: 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


示例4: rend

 def rend(self, *junk):
     (l, middle, r) = self.extract.inContext()
     return tags.div(class_='extract-container')[
             l,
             tags.div(class_='extract-text')[
                 tags.span[middle]],
             r]
开发者ID:pombredanne,项目名称:quotient,代码行数:7,代码来源:extract.py


示例5: test_url

    def test_url(self):
        """
        An L{URL} object is flattened to the appropriate representation of
        itself, whether it is the child of a tag or the value of a tag
        attribute.
        """
        link = URL.fromString("http://foo/fu?bar=baz&bar=baz#quux%2f")
        self.assertStringEqual(
            self.flatten(link),
            "http://foo/fu?bar=baz&bar=baz#quux%2F")
        self.assertStringEqual(
            self.flatten(div[link]),
            '<div>http://foo/fu?bar=baz&amp;bar=baz#quux%2F</div>')
        self.assertStringEqual(
            self.flatten(div(foo=link)),
            '<div foo="http://foo/fu?bar=baz&amp;bar=baz#quux%2F"></div>')
        self.assertStringEqual(
            self.flatten(div[div(foo=link)]),
            '<div><div foo="http://foo/fu?bar=baz&amp;bar=baz#quux%2F"></div>'
            '</div>')

        link = URL.fromString("http://foo/fu?%2f=%7f")
        self.assertStringEqual(
            self.flatten(link),
            "http://foo/fu?%2F=%7F")
        self.assertStringEqual(
            self.flatten(div[link]),
            '<div>http://foo/fu?%2F=%7F</div>')
        self.assertStringEqual(
            self.flatten(div(foo=link)),
            '<div foo="http://foo/fu?%2F=%7F"></div>')
开发者ID:UstadMobile,项目名称:exelearning-ustadmobile-work,代码行数:31,代码来源:test_newflat.py


示例6: test_applicationNavigationChildren

 def test_applicationNavigationChildren(self):
     """
     The L{applicationNavigation} renderer should fill the 'subtabs' slot
     with copies of the 'subtab' pattern for each tab, if that pattern is
     present.  (This is only tested to one level of depth because we
     currently only support one level of depth.)
     """
     tag = self._renderAppNav(
         [
             webnav.Tab("alpha", 123, 0),
             webnav.Tab("beta", 234, 0, children=[webnav.Tab("gamma", 345, 0), webnav.Tab("delta", 456, 0)]),
         ],
         tags.span[
             tags.div(pattern="app-tab"),
             tags.div(pattern="tab-contents"),
             tags.div(pattern="subtab"),
             tags.div(pattern="subtab-contents", class_="subtab-contents-class"),
         ],
     )
     navTags = list(tag.slotData["tabs"])
     self.assertEqual(len(navTags), 2)
     alpha, beta = navTags
     self.assertEqual(alpha.slotData["subtabs"], [])
     self.assertEqual(len(beta.slotData["subtabs"]), 2)
     subtab1 = beta.slotData["subtabs"][0]
     self.assertEqual(subtab1.slotData["name"], "gamma")
     self.assertEqual(subtab1.slotData["href"], "/link/345")
     self.assertEqual(subtab1.slotData["tab-contents"].attributes["class"], "subtab-contents-class")
     subtab2 = beta.slotData["subtabs"][1]
     self.assertEqual(subtab2.slotData["name"], "delta")
     self.assertEqual(subtab2.slotData["href"], "/link/456")
     self.assertEqual(subtab2.slotData["tab-contents"].attributes["class"], "subtab-contents-class")
开发者ID:fusionapp,项目名称:mantissa,代码行数:32,代码来源:test_webnav.py


示例7: calculateDefaultSkin

    def calculateDefaultSkin(self, context):
        if self.isGrouped:
            frm = tags.invisible
            butt = ""
            fld = tags.invisible
        else:
            frm = tags.form(
                id=slot("form-id"),
                name=slot("form-id"),
                action=slot("form-action"),
                method="post",
                enctype="multipart/form-data",
                **{"accept-charset": "utf-8"}
            )
            butt = slot("form-button")
            fld = tags.fieldset[tags.input(type="hidden", name="_charset_")]

        ## Provide default skin since no skin was provided for us.
        context.tag.clear()[
            frm[
                fld[
                    tags.legend(_class="freeform-form-label")[slot("form-label")],
                    tags.div(_class="freeform-form-description")[slot("form-description")],
                    tags.div(_class="freeform-form-error")[slot("form-error")],
                    slot("form-arguments"),
                    butt,
                ]
            ]
        ]
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:29,代码来源:webform.py


示例8: visit_cmsimage_node

    def visit_cmsimage_node(self, node):
        maxwidth=node.attributes['maxwidth']
        maxheight=node.attributes['maxheight']
            
        if maxwidth is None or maxheight is None:
            tag = T.img(src=self.systemURL.child('assets').child( node.attributes['id'] ))
        else:
            tag = T.img(src=self.systemURL.child('assets').child( node.attributes['id'] ).add('size','%sx%s'%(maxwidth,maxheight)))
        
        if node.attributes['alt']:
            tag = tag(alt=node.attributes['alt'])
        if node.attributes['title']:
            tag = tag(title=node.attributes['title'])
        if node.attributes['cssclass']:
            tag = tag(class_=node.attributes['cssclass'])
        if node.attributes['href']:
            tag = T.a(href=node.attributes['href'])[ tag ]
            
        if node.attributes['caption']:
            tag = T.div(class_='cmsimage')[tag,T.p[node.attributes['caption']]]
        else:
            tag = T.div(class_='cmsimage')[tag]
        html = flat.flatten(tag)

        self.body.append(html)
开发者ID:timparkin,项目名称:into-the-light,代码行数:25,代码来源:restsupport.py


示例9: divBar

def divBar(text, width, fraction, barColor):
    fraction = min(1, max(0, fraction))
    sp = T.raw("&nbsp;")
    return T.div(class_="bar", style="width: %spx;" % width)[
        T.div(class_="fill", style="width: %dpx; background: %s" % (width * fraction, barColor))[sp],
        T.div(class_="txt")[text],
        sp,
    ]
开发者ID:drewp,项目名称:magma,代码行数:8,代码来源:homepage.py


示例10: gotAll

        def gotAll(items,categories,products):
            categoryCMSItems = {}
            for item in items:
                i = item.getProtectedObject()
                categoryCMSItems[i.name] = i

            categoryCMSItemMainImage = {}
            categoryCMSItemCode = {}
            for categoryCMSItem in categoryCMSItems.values():
                category = categoryCMSItem.name
                for product in products:
                    if u'gallery.%s'%category in product.categories: 
                        match = product
                        categoryCMSItemMainImage[categoryCMSItem.name] = match.id
                        categoryCMSItemCode[categoryCMSItem.name] = match.code
                        break

            htmlblock = []
            for n, category in enumerate(categories.children):
                name = category.textid
                categoryCMSItem = categoryCMSItems.get(name,None)
                column = divmod(n,3)[1]+1
                try: 
                    title = categoryCMSItem.title
                    shortDescription = categoryCMSItem.shortDescription
                except AttributeError:
                    title = category.label
                    shortDescription = ''
                
                try:
                    imgsrc='/system/ecommerce/%s/mainImage?size=190x300&sharpen=1.0x0.5%%2b0.7%%2b0.1'%categoryCMSItemMainImage[name]
                except KeyError:
                    imgsrc='/skin/images/spacer.gif'
                
                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'%categoryCMSItemCode[name]]
                        ],
                    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,代码行数:58,代码来源:gallery.py


示例11: getWidgetDocument

 def getWidgetDocument(self):
     """
     Return part of a document which contains some explicitly sized
     elements.  The client portion of this test will retrieve them by their
     class value and assert things about their size.
     """
     return tags.div[
         tags.div(class_='foo', style='height: 126px; width: 1px'),
         tags.div(class_='bar', style='padding: 1px 2px 3px 4px; height: 12px; width: 70px')]
开发者ID:StetHD,项目名称:nevow,代码行数:9,代码来源:livetest_runtime.py


示例12: renderImmutable

 def renderImmutable(self, ctx, key, args, errors):
     value = iformal.IStringConvertible(self.original).fromType(args.get(key))
     if value:
         value=T.xml(value)
     else:
         value=''
     return T.div(id=key, class_="readonly-textarea-container") [
         T.div(class_='readonly-textarea readonly')[value]
     ]
开发者ID:bne,项目名称:squeal,代码行数:9,代码来源:htmleditor.py


示例13: render_body

 def render_body(self, ctx, data):
     for j in range(self.maxNodes // self.maxDepth):
         top = t = tags.div()
         for i in range(self.maxDepth):
             m = tags.div()
             t[m]
             t = m
         t[InitializationBenchmark(self)]
         yield top
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:9,代码来源:benchmark.py


示例14: render_middle

    def render_middle(self, context, data):
        yield T.div(render=T.directive('trail'), data=data.get_ancestry())
        yield T.h1(class_='main-heading')[data.title]

        yield T.div(render=T.directive('items'), data=data.get_subdirs())

        yield T.div(render=T.directive('rst'))      

        yield T.div(render=T.directive('items'), data=data.get_items())
开发者ID:BackupTheBerlios,项目名称:pida-svn,代码行数:9,代码来源:www.py


示例15: progressBar

 def progressBar(self, ctx, data):
     name = data.get('name', 'theProgressBar')
     percent = data.get('percent', 0)
     yield t.div(class_='progressBar', id_=str(name))[
         t.div(class_ ='progressBarDiv', style='width: %i%%'%percent) ]
     yield t.script(type='text/javascript')[
         component[name].init('new ProgressBar(%r)'%name),
         #component[name].setPercent(percent)
     ]
开发者ID:UstadMobile,项目名称:exelearning-ustadmobile-work,代码行数:9,代码来源:progressbar.py


示例16: render_field

    def render_field(self, ctx, data):

        # The field we're rendering
        field = self.field

        # Get stuff from the context
        formData = iformal.IFormData(ctx)
        formErrors = iformal.IFormErrors(ctx, None)

        # Find any error
        if formErrors is None:
            error = None
        else:
            error = formErrors.getFieldError(field.key)

        # Build the error message
        if error is None:
            message = ''
        else:
            message = T.div(class_='message')[error.message]

        # Create the widget (it's created in __init__ as a hack)
        widget = self.widget

        # Build the list of CSS classes
        classes = [
            'field',
            field.type.__class__.__name__.lower(),
            widget.__class__.__name__.lower(),
            ]
        if field.type.required:
            classes.append('required')
        if field.cssClass:
            classes.append(field.cssClass)
        if error:
            classes.append('error')

        # Create the widget and decide the method that should be called
        if field.type.immutable:
            render = widget.renderImmutable
        else:
            render = widget.render

        # Fill the slots
        tag = ctx.tag
        tag.fillSlots('id', util.render_cssid(field.key))
        tag.fillSlots('fieldId', [util.render_cssid(field.key), '-field'])
        tag.fillSlots('class', ' '.join(classes))
        tag.fillSlots('label', field.label)
        tag.fillSlots('inputs', render(ctx, field.key, formData,
            formErrors))
        tag.fillSlots('message', message)
        tag.fillSlots('description',
                T.div(class_='description')[field.description or ''])

        return ctx.tag
开发者ID:bne,项目名称:squeal,代码行数:56,代码来源:form.py


示例17: _doubleLiveSerialization

 def _doubleLiveSerialization(self, cls, renderer):
     livePage = DummyLivePage()
     liveFragment = cls(
         docFactory=loaders.stan(
             [tags.div(render=tags.directive(renderer))['Hello'],
              tags.div(render=tags.directive('foo'))]))
     liveFragment.setFragmentParent(livePage)
     self.assertEqual(
         json.serialize(liveFragment),
         json.serialize(liveFragment))
开发者ID:StetHD,项目名称:nevow,代码行数:10,代码来源:test_json.py


示例18: test_stringTagAttributes

 def test_stringTagAttributes(self):
     """
     C{str} L{Tag} attribute values are flattened by applying XML attribute
     value quoting rules.
     """
     self.assertStringEqual(
         self.flatten(div(foo="bar")), '<div foo="bar"></div>')
     self.assertStringEqual(
         self.flatten(div(foo='"><&')),
         '<div foo="&quot;&gt;&lt;&amp;"></div>')
开发者ID:UstadMobile,项目名称:exelearning-ustadmobile-work,代码行数:10,代码来源:test_newflat.py


示例19: _render

        def _render(self, ctx, key, args, errors, value, tag):
            def data_facets(ctx, data):

                storeSession = util.getStoreSession(ctx)
                avatar = util.getAvatar(ctx)

                @defer.deferredGenerator
                def loadCategories(facets):
                    d = defer.waitForDeferred(avatar.getCategoryManager(storeSession))
                    yield d
                    categories = d.getResult()
                    rv = []
                    for f in facets:
                        facetData = FacetData()
                        facetData.label = f[2]
                        facetData.textid = f[1]
                        rv.append(facetData)
                        d = defer.waitForDeferred(categories.loadCategories(facetData.textid))
                        yield d
                        facetData.tree = d.getResult().children
                    yield rv

                d = avatar.getCategoryManager(storeSession)
                d.addCallback(lambda categories: categories.loadFacets())
                d.addCallback(loadCategories)
                return d

            def render_facet(ctx, data):
                tag = ctx.tag
                tag.fillSlots("facetlabel", data.label)
                return tag

            def render_node(ctx, data):
                tag = ctx.tag
                tag.fillSlots("value", data.path)
                tag.fillSlots("label", data.label)
                if data.path in value:
                    tag.children[0] = tag.children[0](checked="checked")
                else:
                    tag.children[0](checked=None)
                return tag

            template = T.div(class_="categorieswidget")[
                T.p(class_="opener")["click to open/close"],
                T.ul(class_="panel", data=data_facets, render=rend.sequence)[
                    T.li(pattern="item", render=render_facet)[
                        T.slot("facetlabel"),
                        T.div(data=T.directive("tree"), render=tree.render)[
                            T.invisible(pattern="item", render=render_node)[tag, T.slot("label")]
                        ],
                    ]
                ],
            ]

            return T.invisible()[template]
开发者ID:timparkin,项目名称:timparkingallery,代码行数:55,代码来源:categorieswidget.py


示例20: test_nested

 def test_nested(self):
     val = []
     def appendKey(ctx, data):
         val.append(ctx.key)
         return ctx.tag
     self.render(
         tags.div(key="one", render=appendKey)[
             tags.div(key="two", render=appendKey)[
                 tags.div(render=appendKey)[
                     tags.div(key="four", render=appendKey)]]])
     self.assertEqual(val, ["one", "one.two", "one.two", "one.two.four"])
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:11,代码来源:test_flatstan.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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