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

Python tags.p函数代码示例

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

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



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

示例1: gotSize

        def gotSize(size):
            quality = ctx.arg('quality')
            large = ctx.arg('large',None)
            if large is not None:            
                size = 'size=968x1200&'
                quality='100'
            else:
                size = 'size=600x632&'
            if quality is None:
                quality = '&quality=60'
                linkhref='?quality=93'
                enhance=T.p(class_='enhance')['click to enhance']
            else:
                quality = '&quality=100'
                linkhref='?large=True'
                enhance = T.p(class_='enhance')['click to see larger']

            if large is not None:
                enhance = T.p(class_='enhance')['click to return to small view']
                linkhref='?quality=93'
                
                
            if common.isInverted(ctx) is True:
                invert='&invert=inverted'
            else:
                invert=''
            imgsrc='/system/ecommerce/%s/mainImage?%ssharpen=1.0x0.5%%2b0.8%%2b0.1%s%s'%(self.photo.id,size,quality,invert)
            html = T.a(class_='photo',href=linkhref)[ enhance,T.img(src=imgsrc) ]
            return html
开发者ID:timparkin,项目名称:into-the-light,代码行数:29,代码来源:gallery.py


示例2: renderOnce

def renderOnce(fragmentClass):
    """
    Create L{DEPTH} LiveFragments, each nested within the next, and then render
    the result.
    """
    rname = fragmentClass.__name__[0].lower() + fragmentClass.__name__[1:]
    innerFragment = fragmentClass(docFactory=stan(p(render=directive(rname))["Hello, world."]))
    for i in xrange(DEPTH - 1):
        outerFragment = fragmentClass(docFactory=stan(p(render=directive(rname))[innerFragment]))
        innerFragment.setFragmentParent(outerFragment)
        innerFragment = outerFragment
    render(outerFragment)
开发者ID:pombredanne,项目名称:quotient,代码行数:12,代码来源:benchmark_livefragment.py


示例3: data_login_form

	def data_login_form(self, ctx, data):
		if(self.user):
			result = tags.p()[
				"You have been successfully logged in as %s" % self.user.username
			]
		else:
			result = tags.form(method="POST")[[
				tags.p()['Enter your OpenID identifier to login:'],
				tags.label(_for="openid-field")["id:"],
				tags.input(type="text", size="60", name="identity"),
				tags.input(type="submit", name="submit", value="login"),
			]]
		return result
开发者ID:iffy,项目名称:txOpenID,代码行数:13,代码来源:resource.py


示例4: render_section

 def render_section(self, ctx, data):
     link = url.root.child('section').child(data['sid'])
     ctx.tag.fillSlots('title', t.a(href=link)[data['stitle']])
     ctx.tag.fillSlots('thread_num', data['thread_num'])
     ctx.tag.fillSlots('description', t.p(_class="desc")[data['sdescription']])
     ctx.tag.fillSlots('lastMod', pptime(data['lastmod']))
     return ctx.tag
开发者ID:BackupTheBerlios,项目名称:weever-svn,代码行数:7,代码来源:index.py


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


示例6: test_data

    def test_data(self):
        ctx = context.WovenContext()

        ctx.remember('foo', inevow.IData)
        tag = p(render=rend.data)
        self.assertEquals(flat.flatten(tag, ctx), '<p>foo</p>')

        ctx.remember('\xc2\xa3'.decode('utf-8'), inevow.IData)
        tag = p(render=rend.data)
        self.assertEquals(flat.flatten(tag, ctx), '<p>\xc2\xa3</p>')

        ctx.remember([1,2,3,4,5], inevow.IData)
        tag = p(render=rend.data)
        self.assertEquals(flat.flatten(tag, ctx), '<p>12345</p>')

        ctx.remember({'foo':'bar'}, inevow.IData)
        tag = p(data=directive('foo'), render=rend.data)
        self.assertEquals(flat.flatten(tag, ctx), '<p>bar</p>')
开发者ID:UstadMobile,项目名称:exelearning-ustadmobile-work,代码行数:18,代码来源:test_rend.py


示例7: data_info

	def data_info(self, ctx, data):
		"""
		Template function to display basic user info.
		"""
		return tags.p()[
			"authorization information for %s (username '%s')." % (
				self.user['first'] + ' ' + self.user['last'],
				self.user['username'],
			)
		]
开发者ID:iffy,项目名称:txOpenID,代码行数:10,代码来源:resource.py


示例8: _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


示例9: render_news

 def render_news(self, ctx, data):
     markup = []
     append = markup.append
     for i in self.data['news'][:self.countItems]:
         append(T.p(_class='datetime')[i['date']])
         append(T.h3[i['title']])
         for para in i['c'].split('\n'):
             if para.strip() == '': continue
             append(self._render_para(para))
             append('\n')
     return markup
开发者ID:BackupTheBerlios,项目名称:pbp-svn,代码行数:11,代码来源:news2html.py


示例10: render_section

 def render_section(self, ctx, data):
     link = url.root.clear().child('section').child(data['sid']).child('')
     if data['lastmod']: tm = pptime(data['lastmod'])
     else: tm = "-"
     if data['thread_num']: n = data['thread_num']
     else: n = "0"
     ctx.tag.fillSlots('title', t.a(href=link)[data['stitle']])        
     ctx.tag.fillSlots('thread_num', n)
     ctx.tag.fillSlots('description', t.p(_class="desc")[data['sdescription']])
     ctx.tag.fillSlots('lastMod', tm)
     return ctx.tag
开发者ID:BackupTheBerlios,项目名称:weever-svn,代码行数:11,代码来源:index.py


示例11: render_images

 def render_images(self, ctx, data):
     """Render a list of images.
     """
     tag = T.div(data=images, render=rend.sequence)[
         T.div(pattern='item')[
             T.p(data=T.directive('filename'), render=T.directive('data')),
             T.ul(data=T.directive('comments'), render=rend.sequence)[
                 T.li(pattern='item', render=T.directive('data')),
                 ],
             ],
         ]
     return tag
开发者ID:BackupTheBerlios,项目名称:cuon-svn,代码行数:12,代码来源:server_web2.py


示例12: render_preview

 def render_preview(self, context, data):
     docstring = parse_str(self.docstring)
     stan, errors = epydoc2stan.doc2html(
         self.ob, docstring=docstring)
     if self.isPreview or errors:
         if errors:
             tag = context.tag
             #print stan, errors
             #assert isinstance(stan, tags.pre)
             [text] = stan.children
             lines = text.replace('\r\n', '\n').split('\n')
             line2err = {}
             for err in errors:
                 if isinstance(err, str):
                     ln = None
                 else:
                     ln = err.linenum()
                 line2err.setdefault(ln, []).append(err)
             w = len(str(len(lines)))
             for i, line in enumerate(lines):
                 i += 1
                 cls = "preview"
                 if i in line2err:
                     cls += " error"
                 tag[tags.pre(class_=cls)["%*s"%(w, i), ' ', line]]
                 for err in line2err.get(i, []):
                     tag[tags.p(class_="errormessage")[err.descr()]]
             i += 1
             for err in line2err.get(i, []):
                 tag[tags.p(class_="errormessage")[err.descr()]]
             items = []
             for err in line2err.get(None, []):
                 items.append(tags.li[str(err)])
             if items:
                 tag[tags.ul[items]]
         else:
             tag = context.tag[stan]
         return tag[tags.h2["Edit"]]
     else:
         return ()
开发者ID:davidsansome,项目名称:babbledrive,代码行数:40,代码来源:server.py


示例13: test_missingRenderMethod

 def test_missingRenderMethod(self):
     """
     Test that flattening an L{Element} with a C{docFactory} which has a tag
     with a render directive fails with L{FlattenerError} if there is no
     available render method to satisfy that directive.
     """
     element = Element(docFactory=stan(p(render=directive('renderMethod'))))
     def cb(ignored):
         # The old flattener unconditionally logs errors.
         self.flushLoggedErrors(MissingRenderMethod)
     d = self.assertFailure(self._render(element), FlattenerError)
     d.addCallback(cb)
     return d
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:13,代码来源:test_element.py


示例14: test_elementContainingStaticElement

 def test_elementContainingStaticElement(self):
     """
     Test that a Element which is returned by the render method of another
     Element is rendered properly.
     """
     class RenderfulElement(Element):
         def renderMethod(self, request, tag):
             return tag[Element(docFactory=stan("Hello, world."))]
         renderer(renderMethod)
     f = RenderfulElement(
         docFactory=stan(p(render=directive('renderMethod'))))
     return self._render(f).addCallback(
         self.assertEqual, "<p>Hello, world.</p>")
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:13,代码来源:test_element.py


示例15: helpLister

    def helpLister(context, data):
        ret = []
        for label, noteex, eachList in help:
            ret.append(T.h4 [ label.encode('utf-8')] )

            for i in noteex:
                if type(i) == type("") or type(i) is unicode:
                    ret.append(T.p(class_="note") [ i.encode('utf-8') ])
                else:
                    ret.append(processEx(i))

            ret.append(processTable(eachList))

        return ret
开发者ID:ImHimanShoe,项目名称:Quillpad-Server,代码行数:14,代码来源:primaryHelper.py


示例16: test_stanDirectiveRenderingOmittingTag

 def test_stanDirectiveRenderingOmittingTag(self):
     """
     Test that a Element with a render method which omits the containing
     tag successfully removes that tag from the output.
     """
     class RenderfulElement(Element):
         def renderMethod(self, request, tag):
             return "Hello, world."
         renderer(renderMethod)
     f = RenderfulElement(
         docFactory=stan(p(render=directive('renderMethod'))[
                 "Goodbye, world."]))
     return self._render(f).addCallback(
         self.assertEqual, "Hello, world.")
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:14,代码来源:test_element.py


示例17: test_oldFlattenableInAttribute

 def test_oldFlattenableInAttribute(self):
     """
     Flattening a L{Element} as the value of an attribute of a L{Tag} XML
     attribute escapes the element's flattened document.
     """
     result = []
     element = Element()
     element.docFactory = stan(['"&<>'])
     request = FakeRequest()
     context = WovenContext()
     context.remember(request)
     finished = oldFlatten(p(foo=element), context, result.append, lambda ign: ign)
     finished.addCallback(lambda ign: "".join(result))
     finished.addCallback(self.assertEqual, '<p foo="&quot;&amp;&lt;&gt;"></p>')
     return finished
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:15,代码来源:test_element.py


示例18: render_section

 def render_section(self, ctx, data):
     link = url.root.clear().child("section").child(data["sid"])
     if data["lastmod"]:
         tm = pptime(data["lastmod"])
     else:
         tm = "-"
     if data["thread_num"]:
         n = data["thread_num"]
     else:
         n = "0"
     ctx.tag.fillSlots("title", t.a(href=link)[data["stitle"]])
     ctx.tag.fillSlots("thread_num", n)
     ctx.tag.fillSlots("description", t.p(_class="desc")[data["sdescription"]])
     ctx.tag.fillSlots("lastMod", tm)
     return ctx.tag
开发者ID:BackupTheBerlios,项目名称:weever-svn,代码行数:15,代码来源:index.py


示例19: test_precompileWithRenderer

 def test_precompileWithRenderer(self):
     tag = tags.html[
         tags.body[
             tags.div[
                 tags.p["Here's a string"],
                 tags.p(data=5, render=str)
             ]
         ]
     ]
     prelude, context, postlude = self.render(tag, precompile=True)
     self.assertEqual(prelude, "<html><body><div><p>Here's a string</p>")
     self.assertEqual(context.tag.tagName, "p")
     self.assertEqual(context.tag.data, 5)
     self.assertEqual(context.tag.render, str)
     self.assertEqual(postlude, '</div></body></html>')
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:15,代码来源:test_flatstan.py


示例20: test_elementContainingDynamicElement

 def test_elementContainingDynamicElement(self):
     """
     Test that directives in the document factory of a Element returned from a
     render method of another Element are satisfied from the correct object:
     the "inner" Element.
     """
     class OuterElement(Element):
         def outerMethod(self, request, tag):
             return tag[InnerElement(docFactory=stan(directive("innerMethod")))]
         renderer(outerMethod)
     class InnerElement(Element):
         def innerMethod(self, request, tag):
             return "Hello, world."
         renderer(innerMethod)
     f = OuterElement(
         docFactory=stan(p(render=directive('outerMethod'))))
     return self._render(f).addCallback(
         self.assertEqual, "<p>Hello, world.</p>")
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:18,代码来源:test_element.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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