本文整理汇总了Python中nevow.stan.xml函数的典型用法代码示例。如果您正苦于以下问题:Python xml函数的具体用法?Python xml怎么用?Python xml使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xml函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: renderInlineException
def renderInlineException(self, context, reason):
from nevow import failure
formatted = failure.formatFailure(reason)
desc = str(reason)
return flat.serialize([
stan.xml("""<div style="border: 1px dashed red; color: red; clear: both" onclick="this.childNodes[1].style.display = this.childNodes[1].style.display == 'none' ? 'block': 'none'">"""),
desc,
stan.xml('<div style="display: none">'),
formatted,
stan.xml('</div></div>')
], context)
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:11,代码来源:appserver.py
示例2: pageContent
def pageContent(self,ctx,data):
content = ctx.locate(IWikiContent)
return T.div(style="margin:4px;")[
content and
stan.xml(format(content)) or
"This page does not yet exist."
]
开发者ID:jamwt,项目名称:pgasync,代码行数:7,代码来源:wiki.py
示例3: render_results
def render_results(self, ctx, data):
if data is None:
return ctx.tag
success, query, db, total = data
if not success:
ctx.tag[T.h1[u'Failed to process query %s' % query]]
ctx.tag[T.pre[str(db)]]
return ctx.tag
ctx.tag[T.h1[u'%d/%d results for query "%s"' % (
len(db.entries), total, query)]]
# Cite the records
formatter = citation(db)
cited = T.ul[[T.li[stan.xml(generate(formatter(record)))]
for record in db.entries.itervalues()]]
ctx.tag[cited]
# Display the raw BibTeX too
res = StringIO()
w.write(res, db.entries, db)
res = res.getvalue().decode('utf-8')
ctx.tag[T.pre[res]]
return ctx.tag
开发者ID:zkota,项目名称:pyblio-core-1.3,代码行数:31,代码来源:pubmed.py
示例4: render
def render(self, ctx, data):
"""
Returns an html string for viewing this pane
"""
# Create a scecial server side func that the
# Idevice editor js can call
#addHandler = handler(self.handleAddIdevice,
# identifier='outlinePane.handleAddIdevice')
# The below call stores the handler so we can call it
# as a server
#addHandler(ctx, data)
# Now do the rendering
log.debug("Render")
html = u"<!-- IDevice Pane Start -->\n"
html += u"<listbox id=\"ideviceList\" flex=\"1\" "
html += u"style=\"background-color: #FFF;\">\n"
prototypes = self.prototypes.values()
def sortfunc(pt1, pt2):
"""Used to sort prototypes by title"""
return cmp(pt1.title, pt2.title)
prototypes.sort(sortfunc)
for prototype in prototypes:
if prototype._title.lower() not in G.application.config.hiddeniDevices \
and prototype._title.lower() \
not in G.application.config.deprecatediDevices:
html += self.__renderPrototype(prototype)
html += u"</listbox>\n"
html += u"<!-- IDevice Pane End -->\n"
return stan.xml(html.encode('utf8'))
开发者ID:erral,项目名称:iteexe,代码行数:33,代码来源:idevicepane.py
示例5: beforeRender
def beforeRender(self, ctx):
formDefs = iformless.IFormDefaults(ctx).getAllDefaults('updateWiki')
content = IWikiContent(ctx)
formDefs['new'] = "0"
if content:
formDefs['text'] = stan.xml(content)
else:
formDefs['new'] = "1"
开发者ID:jamwt,项目名称:pgasync,代码行数:8,代码来源:wiki.py
示例6: startDTD
def startDTD(self, name, publicId, systemId):
if self.ignoreDocType:
return
# Check for broken startDTD
if bad_startdtd_args:
systemId, publicId = publicId, systemId
doctype = '<!DOCTYPE %s\n PUBLIC "%s"\n "%s">\n' % (name, publicId, systemId)
self.current.append(xml(doctype))
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:8,代码来源:flatsax.py
示例7: urlToChild
def urlToChild(ctx, *ar, **kw):
u = url.URL.fromContext(ctx)
for segment in ar:
u = u.child(stan.xml(segment))
if inevow.IRequest(ctx).method == 'POST':
u = u.clear()
for k,v in kw.items():
u = u.replace(k, v)
return u
开发者ID:comfuture,项目名称:numbler,代码行数:10,代码来源:guard.py
示例8: render_debugInfo
def render_debugInfo(self, ctx, data):
"""Renders debug info to the to
of the screen if logging is set to debug level
"""
if log.getEffectiveLevel() == logging.DEBUG:
# TODO: Needs to be updated by xmlhttp or xmlrpc
request = inevow.IRequest(ctx)
return stan.xml(('<hbox id="header">\n'
' <label>%s</label>\n'
' <label>%s</label>\n'
'</hbox>\n' %
([escape(x) for x in request.prepath],
escape(self.package.name))))
else:
return ''
开发者ID:giorgil2,项目名称:eXe,代码行数:15,代码来源:mainpage.py
示例9: test_basicPythonTypes
def test_basicPythonTypes(self):
tag = proto(data=5)[
"A string; ",
"A unicode string; ",
5, " (An integer) ",
1.0, " (A float) ",
1, " (A long) ",
True, " (A bool) ",
["A ", "List; "],
stan.xml("<xml /> Some xml; "),
lambda data: "A function"
]
if self.hasBools:
self.assertEqual(self.render(tag), "<hello>A string; A unicode string; 5 (An integer) 1.0 (A float) 1 (A long) True (A bool) A List; <xml /> Some xml; A function</hello>")
else:
self.assertEqual(self.render(tag), "<hello>A string; A unicode string; 5 (An integer) 1.0 (A float) 1 (A long) 1 (A bool) A List; <xml /> Some xml; A function</hello>")
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:16,代码来源:test_flatstan.py
示例10: render
def render(self, ctx, data):
"""
Returns an XUL string for viewing this pane
"""
log.debug("render")
# Render the start tags
xul = u"<!-- Styles Pane Start -->\n"
xul += u"<menupopup>\n"
# Render each style individually
printableStyles = [(x.capitalize(), x) for x in self.config.styles]
for printableStyle, style in sorted(printableStyles, key=lambda x: x[0]):
xul += u" <menuitem label=\""+printableStyle+"\" "
xul += u"oncommand=\"submitLink('ChangeStyle', '"+style+"', 1);\"/>\n"
# Render the end tags
xul += u"</menupopup>\n"
xul += u"<!-- Styles Pane End -->\n"
return stan.xml(xul)
开发者ID:kohnle-lernmodule,项目名称:palama,代码行数:19,代码来源:stylemenu.py
示例11: render
def render(self, ctx, data):
"""
Returns an XUL string for viewing this pane
"""
log.debug("render")
# Render the start tags
xul = u"<!-- Styles Pane Start -->\n"
xul += u"<menupopup>\n"
# Render each style individually
for style in self.config.styles:
name = style[style.find("/") + 1:]
xul += u" <menuitem label=\"" + name.capitalize() + "\" "
xul += u"oncommand=\"submitLink('ChangeStyle', '" + style +\
"', 1);\"/>\n"
# Render the end tags
xul += u"<menuseparator/>"
xul += u"<menuitem label=\"Add Style\" oncommand=\"addStyle()\"/>"
xul += u"</menupopup>\n"
xul += u"<!-- Styles Pane End -->\n"
return stan.xml(xul)
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:22,代码来源:stylemenu.py
示例12: describe_build
def describe_build(branch, build):
"""Return a nevow HTML description of a build"""
change_report_dir = CHANGE_REPORT_DIRECTORY % (branch, build)
if os.path.isdir(change_report_dir):
content = os.listdir(change_report_dir)
for stuff in content:
if 'diff' in stuff or stuff.endswith('.error'):
continue
filename = os.path.join(change_report_dir, stuff)
try:
content = file(filename, 'r').read()
except IOError:
continue
bod_start = content.find('<body>')
bod_end = content.find('</body>')
if bod_start != -1 and bod_end != -1:
return [xml(content[bod_start+6:bod_end])]
else:
return [space_span()['could not find body in ', filename]]
return [space_span()[em['could not find build description in ',
change_report_dir]]]
else:
return [space_span()['could not find ', change_report_dir]]
开发者ID:OpenXT,项目名称:bvt,代码行数:23,代码来源:describe_build.py
示例13: processingInstruction
def processingInstruction(self, target, data):
self.current.append(xml("<?%s %s?>\n" % (target, data)))
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:2,代码来源:flatsax.py
示例14: skippedEntity
def skippedEntity(self, name):
self.current.append(xml("&%s;"%name))
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:2,代码来源:flatsax.py
示例15: comment
def comment(self, content):
if self.ignoreComment:
return
self.current.append( (xml('<!--'),xml(content),xml('-->')) )
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:4,代码来源:flatsax.py
示例16: endCDATA
def endCDATA(self):
self.inCDATA = False
self.current.append(xml(']]>'))
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:3,代码来源:flatsax.py
示例17: startCDATA
def startCDATA(self):
self.inCDATA = True
self.current.append(xml('<![CDATA['))
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:3,代码来源:flatsax.py
示例18: inlineJS
def inlineJS(s):
return script(type="text/javascript")[xml('\n//<![CDATA[\n%s\n//]]>\n' % s)]
开发者ID:KatiaBorges,项目名称:exeLearning,代码行数:2,代码来源:tags.py
示例19: characters
def characters(self, ch):
# CDATA characters should be passed through as is.
if self.inCDATA:
ch = xml(ch)
self.current.append(ch)
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:5,代码来源:flatsax.py
注:本文中的nevow.stan.xml函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论