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

Python tags.xml函数代码示例

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

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



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

示例1: render_publicationDiv

 def render_publicationDiv(self, context, data):
     if self.query.order == 'publication_time':
         return tags.xml('<span class="selectedCriterium">'
                         'publication time</span>')
     else:
         return tags.xml("""<span class="unselectedCriterium"><a href="javascript: sortBy('publication_time');">"""
                         'publication time</a></span>')
开发者ID:BackupTheBerlios,项目名称:maay-svn,代码行数:7,代码来源:webapplication.py


示例2: render_popularityDiv

 def render_popularityDiv(self, context, data):
     if self.query.order == 'popularity':
         return tags.xml('<span class="selectedCriterium">'
                         'popularity</span>')
     else:
         return tags.xml("""<span class="unselectedCriterium"><a href="javascript: sortBy('popularity');">"""
                         'popularity</a></span>')
开发者ID:BackupTheBerlios,项目名称:maay-svn,代码行数:7,代码来源:webapplication.py


示例3: render_relevanceDiv

 def render_relevanceDiv(self, context, data):
     if self.query.order == 'relevance':
         return tags.xml('<span class="selectedCriterium">'
                         'relevance</span>')
     else:
         return tags.xml("""<span class="unselectedCriterium"><a href="javascript: sortBy('relevance');">"""
                         'relevance</a></span>')
开发者ID:BackupTheBerlios,项目名称:maay-svn,代码行数:7,代码来源:webapplication.py


示例4: test_xml

 def test_xml(self):
     """
     An L{xml} instance is flattened to the UTF-8 representation of itself.
     """
     self.assertStringEqual(self.flatten(xml("foo")), "foo")
     unich = u"\N{LATIN CAPITAL LETTER E WITH GRAVE}"
     self.assertStringEqual(self.flatten(xml(unich)), unich.encode('utf-8'))
开发者ID:UstadMobile,项目名称:exelearning-ustadmobile-work,代码行数:7,代码来源:test_newflat.py


示例5: cruftifyMultipleSpaces

 def cruftifyMultipleSpaces(text):
     """Replace multiple spaces with &nbsp; such that they are rendered as we want."""
     if text.startswith(' '):
         yield tags.xml('&#160;')
         text = text[1:]
     chunks = text.split('  ')
     for i in SpacePreservingStringRenderer.intersperse(tags.xml(' &#160;'), chunks):
         yield i
开发者ID:pombredanne,项目名称:quotient,代码行数:8,代码来源:renderers.py


示例6: inlineJSSerializer

def inlineJSSerializer(original, ctx):
    from nevow import livepage
    from nevow.tags import script, xml
    theJS = livepage.js(original.children)
    new = livepage.JavascriptContext(ctx, invisible[theJS])
    return serialize(script(type="text/javascript")[
        xml('\n//<![CDATA[\n'),
        serialize(theJS, new),
        xml('\n//]]>\n')], ctx)
开发者ID:UstadMobile,项目名称:exelearning-ustadmobile-work,代码行数:9,代码来源:flatstan.py


示例7: head

    def head(self, request, website):
        def styleSheetLink(href):
            return tags.link(rel='stylesheet', type='text/css', href=href)

        root = website.cleartextRoot(request.getHeader('host'))
        styles = root.child('Eridanus').child('static').child('styles')

        yield styleSheetLink(styles.child('eridanus.css'))
        yield tags.xml(u'<!--[if IE 6]>'), styleSheetLink(styles.child('eridanus-ie6.css')), tags.xml(u'<![endif]-->')
        yield tags.xml(u'<!--[if IE 7]>'), styleSheetLink(styles.child('eridanus-ie7.css')), tags.xml(u'<![endif]-->')
开发者ID:mithrandi,项目名称:eridanus,代码行数:10,代码来源:theme.py


示例8: render_next

 def render_next(self, context, data):
     """computes 'Next' link"""
     localCount, distantCount = self.querier.countResults(self.qid)
     if self.onlyDistant:
         resultsCount = distantCount
     elif self.onlyLocal:
         resultsCount = localCount
     else:
         resultsCount = localCount + distantCount
     offset = self.query.offset
     if (offset + 15) < resultsCount:
         return tags.xml('<a href="javascript: browseResults(%s);">Next</a>' % (offset + 15))
     return tags.xml('<span class="selectedCriterium">Next</span>')
开发者ID:BackupTheBerlios,项目名称:maay-svn,代码行数:13,代码来源:webapplication.py


示例9: head

    def head(self, request, website):
        def styleSheetLink(href):
            return tags.link(rel='stylesheet', type='text/css', href=href)

        root = website.rootURL(request)
        styles = root.child('static').child('Methanal').child('styles')

        yield styleSheetLink(styles.child('methanal.css'))
        yield (tags.xml(u'<!--[if IE 6]>'),
               styleSheetLink(styles.child('methanal-ie6.css')),
               tags.xml(u'<![endif]-->'))
        yield (tags.xml(u'<!--[if IE 7]>'),
               styleSheetLink(styles.child('methanal-ie7.css')),
               tags.xml(u'<![endif]-->'))
开发者ID:jonathanj,项目名称:methanal,代码行数:14,代码来源:theme.py


示例10: render_item_template_js

    def render_item_template_js(self, ctx, data):
        html = T.script(type="text/javascript", language="javascript" )

        js = """function getTemplates(plugin) {
                %(pluginTemplates)s
            }
            """

        fragment = """ if(plugin == "%(plugin)s") {
                return new Array(%(templates)s);
            }
            """

        fragments = []

        for plugin in self._typesList(ctx):
            templates = ','.join( ['["%s","%s"]'%(t[0],t[1]) for t in plugin.listTemplates])
            fragments.append(fragment%{'plugin':plugin.contentItemClass.__typename__,
                'templates':templates})

        fragments.append( """ { return new Array(); } """)

        pluginTemplates = ' else '.join(fragments)
        js = js%{'pluginTemplates': pluginTemplates}
        return html[T.xml(js)]
开发者ID:timparkin,项目名称:into-the-light,代码行数:25,代码来源:itemselection.py


示例11: render_basket_item

 def render_basket_item(self, ctx, basketItem):
     ctx.tag.fillSlots('code', basketItem.code or '')
     ctx.tag.fillSlots('description', T.xml(basketItem.description) or '')
     ctx.tag.fillSlots('quantity_ordered', basketItem.quantity_ordered)
     ctx.tag.fillSlots('unit_price', basketItem.unit_price)
     ctx.tag.fillSlots('total_price', basketItem.total_price)
     return ctx.tag
开发者ID:timparkin,项目名称:into-the-light,代码行数:7,代码来源:web.py


示例12: render_basket_item

 def render_basket_item(self, ctx, basketItem): 
     #ctx.tag.fillSlots('thumbnail', T.img(src='/system/ecommerce/%s/mainImage?size=95x150&sharpen=1.0x0.5%%2b0.8%%2b0.1'%basketItem.original.product.id, class_='thumbnail'))
     ctx.tag.fillSlots('description', T.xml(basketItem.description))
     ctx.tag.fillSlots('unit_price', basketItem.unit_price)
     ctx.tag.fillSlots('quantity_ordered', basketItem.quantity_ordered)
     ctx.tag.fillSlots('total_price', basketItem.total_price)
     return ctx.tag
开发者ID:timparkin,项目名称:into-the-light,代码行数:7,代码来源:basket.py


示例13: flattenIText

def flattenIText(orig, ctx):
    assert orig.dom.nodeType == orig.dom.ELEMENT_NODE
    assert orig.dom.namespaceURI == 'http://www.w3.org/1999/xhtml'
    assert orig.dom.nodeName == 'div'

    for node in orig.dom.childNodes:
        yield tags.xml(node.toxml())
开发者ID:tv42,项目名称:atomat,代码行数:7,代码来源:iatom.py


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


示例15: render_htmlizer

    def render_htmlizer(self, ctx, path):
        from twisted.python import htmlizer
        from StringIO import StringIO

        output = StringIO()
        htmlizer.filter(open(path), output, writer=htmlizer.SmallerHTMLWriter)
        return tags.xml(output.getvalue())
开发者ID:BackupTheBerlios,项目名称:nufox-svn,代码行数:7,代码来源:_base.py


示例16: render_item

    def render_item(self, ctx, data):
        u = url.URL.fromContext(ctx)
        u = url.URL(u.scheme, u.netloc, self.page[0].split('/')[1:])
        ctx.tag.fillSlots('path', self.page[0])
        ctx.tag.fillSlots('href', u)
        ctx.tag.fillSlots('title', self.page[1])
        q = ctx.arg('q')
        if q.lower() in self.page[3].lower():
            highspan = 50
            lowspan = 180
            wrapper = '<strong>%s</strong>'
            offset = self.page[3].lower().find(q.lower())
    
            import re
            cre=re.compile(q,re.IGNORECASE)
            if offset-lowspan <0:
                lower = 0
            else:
                lower = offset-lowspan
            if offset+highspan > len(self.page[3]):
                higher = len(self.page[3])
            else:
                higher = offset+highspan
            out = cre.sub(wrapper%q,self.page[3][lower:higher])
            ctx.tag.fillSlots('summary', T.xml(out))
        else:
            ctx.tag.fillSlots('summary', self.page[2])

        return ctx.tag
开发者ID:timparkin,项目名称:into-the-light,代码行数:29,代码来源:search.py


示例17: fillReply

def fillReply(ctx, d):
    ctx.tag.fillSlots('id', d.get('pid'))
    ctx.tag.fillSlots('edit', '/edit.xhtml')
    ctx.tag.fillSlots('title', d.get('ttitle'))
    ctx.tag.fillSlots('body', t.xml(d.get('pparsed_body')))
    ctx.tag.fillSlots('userpref', url.root.clear().child('user').child(str(d.get('ulogin'))))
    ctx.tag.fillSlots('owner', d.get('powner'))
    ctx.tag.fillSlots('when', pptime(d.get('pmodification')))
开发者ID:BackupTheBerlios,项目名称:weever-svn,代码行数:8,代码来源:topic.py


示例18: block

 def block(context, data):
     client = IClientHandle(context)
     if identifier is None:
         iden = client.events.nextId()
     else:
         iden = identifier
     client.events.subscribe(iden, callit)
     return tags.xml(ctsTemplate % (iden, argstr, postlude ))
开发者ID:Rafav,项目名称:iteexe,代码行数:8,代码来源:livepage.py


示例19: renderHTTP

    def renderHTTP(self, ctx):

        self.setup()

        #ensure that we are delivered with the correct content type header
        inevow.IRequest(ctx).setHeader("Content-Type",
            "application/vnd.mozilla.xul+xml; charset=%s" % (self.charset,))

        #Do something a bit magical.. glue css/js stuff into the window before
        #any other widgets so they get read first.
        if self.css is not None:
            self.window.children.insert(0,
                htmlns.style(type="text/css")[self.css])
        self.css = None

        for css in self.cssIncludes:
            self.window.children.insert(0,
                htmlns.style(type="text/css", src=css))
        self.cssIncludes = []

        if self.js is not None:
            self.window.children.insert(0,
                htmlns.script(type="text/javascript")[self.js])
        self.js = None

        for js in self.jsIncludes:
            self.window.children.insert(0,
                htmlns.script(type="text/javascript", src=js))
        self.jsIncludes = []

        #We want to have javascript included in this order:
        #   preLiveglue.js
        #   liveglue.js
        #   postLiveglue.ps

        if not self.glueInstalled:

            self.window.children.insert(0, htmlns.script(
                type="text/javascript", src=url.here.child(
                    'javascript').child('postLiveglue.js')))

            self.window.children.insert(0, T.invisible(
                render=T.directive('liveglue')))

            self.window.children.insert(0, htmlns.script(
                type="text/javascript", src=url.here.child(
                    'javascript').child('preLiveglue.js')))

            self.glueInstalled = True

        #.. end magical

        #make sure our XUL tree is loaded and our correct doc type is set
        self.docFactory = loaders.stan([
            T.xml("""<?xml version="1.0"?><?xml-stylesheet href="chrome://global/skin/" type="text/css"?>"""),
            self.window])
        #return our XUL
        return athena.LivePage.renderHTTP(self, ctx)
开发者ID:BackupTheBerlios,项目名称:nufox-svn,代码行数:58,代码来源:xul.py


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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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