本文整理汇总了Python中nevow.tags.ul函数的典型用法代码示例。如果您正苦于以下问题:Python ul函数的具体用法?Python ul怎么用?Python ul使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ul函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: render
def render(ctx, data):
def render_children(ctx, data):
yield [T.invisible(data=child, render=render_node) for child in data ]
def render_node(ctx, data):
tag = T.li[item()]
children = INode(data).children
if children:
tag[T.ul[render_children(ctx, children)]]
return tag
item = inevow.IQ(ctx).patternGenerator('item')
try:
itemdisabled = inevow.IQ(ctx).patternGenerator('itemdisabled')
except stan.NodeNotFound:
itemdisabled = item
tag = T.ul()
if isinstance(data, (tuple,list)):
tag = tag[render_children]
else:
tag = tag[render_node]
return tag
开发者ID:timparkin,项目名称:into-the-light,代码行数:25,代码来源:tree.py
示例2: render_links
def render_links(self, context, data):
ds = self.root.edits(self.ob)
therange = range(len(ds))
rev = therange[self.rev]
ul = tags.ul()
for i in therange:
li = tags.li()
if i:
li[tags.a(href=url.URL.fromContext(context).sibling(
'diff').add(
'ob', self.ob.fullName()).add(
'revA', i-1).add(
'revB', i))["(diff)"]]
else:
li["(diff)"]
li[" - "]
if i == len(ds) - 1:
label = "Latest"
else:
label = str(i)
if i == rev:
li[label]
else:
li[tags.a(href=url.gethere.replace('rev', str(i)))[label]]
li[' - ' + ds[i].user + '/' + ds[i].time]
ul[li]
return context.tag[ul]
开发者ID:davidsansome,项目名称:babbledrive,代码行数:27,代码来源:server.py
示例3: render_lease_last_cycle_results
def render_lease_last_cycle_results(self, ctx, data):
lc = self.storage.lease_checker
h = lc.get_state()["history"]
if not h:
return ""
last = h[max(h.keys())]
start, end = last["cycle-start-finish-times"]
ctx.tag["Last complete cycle (which took %s and finished %s ago)"
" recovered: " % (abbreviate_time(end-start),
abbreviate_time(time.time() - end)),
self.format_recovered(last["space-recovered"], "actual")
]
p = T.ul()
def add(*pieces):
p[T.li[pieces]]
saw = self.format_recovered(last["space-recovered"], "examined")
add("and saw a total of ", saw)
if not last["expiration-enabled"]:
rec = self.format_recovered(last["space-recovered"], "configured")
add("but expiration was not enabled. If it had been, "
"it would have recovered: ", rec)
if last["corrupt-shares"]:
add("Corrupt shares:",
T.ul[ [T.li[ ["SI %s shnum %d" % corrupt_share
for corrupt_share in last["corrupt-shares"] ]
]]])
return ctx.tag[p]
开发者ID:GunioRobot,项目名称:tahoe-lafs,代码行数:33,代码来源:storage.py
示例4: render_pagination
def render_pagination(self, ctx, data):
pagin = T.ul(id='pagination')
numPages = self.getNumPages()
request = inevow.IRequest(ctx)
href = str(request.URLPath())
def createPageLink(pageId, pageTitle, isActive=False):
_ = pagin[T.li(_class = 'active' if isActive else '')[
T.a(onclick=livepage.server.handle('page', pageId),
href='#')[pageTitle]]]
firstPage = max(self.pageId - 1, 0)
lastPage = min(firstPage + 3, numPages)
# print 'first: %d last: %d num: %d cur: %d' % (firstPage, lastPage, numPages, self.pageId)
if firstPage > 0:
createPageLink(0, '<<')
if self.pageId > 0:
createPageLink(self.pageId - 1, '<')
pageList = map(lambda p: (p, str(p+1)), range(firstPage, lastPage))
for pageId, pageTitle in pageList:
createPageLink(pageId, pageTitle, pageId == self.pageId)
if self.pageId < (numPages - 1):
createPageLink(self.pageId + 1, '>')
if lastPage < numPages:
createPageLink(numPages, '>>')
return pagin
开发者ID:myaut,项目名称:tsload,代码行数:34,代码来源:pagination.py
示例5: create_nav_list
def create_nav_list(self, ctx, items, uri_builder, external=False, disabled=False):
tmp = inevow.IRequest(ctx).URLPath()
tmp = tmp.clear() # remove query parameters
pageuri = str(tmp)
ul = T.ul()
for [text, urilist] in items:
classes = []
if disabled:
classes.append('disabled')
li = T.li[text]
else:
# first uri in list is the 'primary' URI (in menu)
href = uri_builder(urilist[0])
a = T.a(href=href)[text]
if external:
a(target='_blank')
li = T.li[a]
for u in urilist:
# any uri in the list is recognized as 'current' page
if pageuri.endswith(u): # XXX: could be better
classes.append('current')
break
if len(classes) > 0:
li(_class=' '.join(classes))
ul[li]
return ul
开发者ID:nakedible,项目名称:vpnease-l2tp,代码行数:28,代码来源:commonpage.py
示例6: _got
def _got(server_problems):
if not server_problems:
return ""
l = T.ul()
for peerid in sorted(server_problems.keys()):
peerid_s = idlib.shortnodeid_b2a(peerid)
l[T.li["[%s]: %s" % (peerid_s, server_problems[peerid])]]
return T.li["Server Problems:", l]
开发者ID:wwaites,项目名称:tahoe-lafs,代码行数:8,代码来源:status.py
示例7: _render
def _render(sharemap):
if sharemap is None:
return "None"
l = T.ul()
for shnum, servers in sorted(sharemap.items()):
server_names = ', '.join([s.get_name() for s in servers])
l[T.li["%d -> placed on [%s]" % (shnum, server_names)]]
return l
开发者ID:wwaites,项目名称:tahoe-lafs,代码行数:8,代码来源:status.py
示例8: _render
def _render(sharemap):
if sharemap is None:
return "None"
l = T.ul()
for shnum, peerids in sorted(sharemap.items()):
peerids = ', '.join([idlib.shortnodeid_b2a(i) for i in peerids])
l[T.li["%d -> placed on [%s]" % (shnum, peerids)]]
return l
开发者ID:joepie91,项目名称:tahoe-lafs,代码行数:8,代码来源:status.py
示例9: _render
def _render(per_server):
if per_server is None:
return ""
l = T.ul()
for peerid in sorted(per_server.keys()):
peerid_s = idlib.shortnodeid_b2a(peerid)
times_s = ", ".join([self.render_time(None, t) for t in per_server[peerid]])
l[T.li["[%s]: %s" % (peerid_s, times_s)]]
return T.li["Per-Server Segment Fetch Response Times: ", l]
开发者ID:GunioRobot,项目名称:tahoe-lafs,代码行数:9,代码来源:status.py
示例10: entrySerializer
def entrySerializer(original, context):
ul = tags.ul()
for a,l in original.items():
if len(l)==0:
ul[tags.li[a, ': none']]
elif len(l)==1:
for attr in l:
first = attr
break
ul[tags.li[a, ': ', first]]
else:
li=tags.li[a, ':']
ul[li]
liul=tags.ul()
li[liul]
for i in l:
liul[tags.li[i]]
return flat.serialize(ul, context)
开发者ID:KenMacD,项目名称:ldaptor,代码行数:18,代码来源:weave.py
示例11: render_problems
def render_problems(self, ctx, data):
problems = data.problems
if not problems:
return ""
l = T.ul()
for peerid in sorted(problems.keys()):
peerid_s = idlib.shortnodeid_b2a(peerid)
l[T.li["[%s]: %s" % (peerid_s, problems[peerid])]]
return ctx.tag["Server Problems:", l]
开发者ID:wwaites,项目名称:tahoe-lafs,代码行数:9,代码来源:status.py
示例12: render_sharemap
def render_sharemap(self, ctx, data):
servermap = data.get_servermap()
if servermap is None:
return ctx.tag["None"]
l = T.ul()
sharemap = servermap.make_sharemap()
for shnum in sorted(sharemap.keys()):
l[T.li["%d -> Placed on " % shnum, ", ".join(["[%s]" % server.get_name() for server in sharemap[shnum]])]]
return ctx.tag["Sharemap:", l]
开发者ID:GunioRobot,项目名称:tahoe-lafs,代码行数:9,代码来源:status.py
示例13: render_lease_current_cycle_results
def render_lease_current_cycle_results(self, ctx, data):
lc = self.storage.lease_checker
p = lc.get_progress()
if not p["cycle-in-progress"]:
return ""
s = lc.get_state()
so_far = s["cycle-to-date"]
sr = so_far["space-recovered"]
er = s["estimated-remaining-cycle"]
esr = er["space-recovered"]
ec = s["estimated-current-cycle"]
ecr = ec["space-recovered"]
p = T.ul()
def add(*pieces):
p[T.li[pieces]]
def maybe(d):
if d is None:
return "?"
return "%d" % d
add("So far, this cycle has examined %d shares in %d buckets"
% (sr["examined-shares"], sr["examined-buckets"]),
" (%d mutable / %d immutable)"
% (sr["examined-buckets-mutable"], sr["examined-buckets-immutable"]),
" (%s / %s)" % (abbreviate_space(sr["examined-diskbytes-mutable"]),
abbreviate_space(sr["examined-diskbytes-immutable"])),
)
add("and has recovered: ", self.format_recovered(sr, "actual"))
if so_far["expiration-enabled"]:
add("The remainder of this cycle is expected to recover: ",
self.format_recovered(esr, "actual"))
add("The whole cycle is expected to examine %s shares in %s buckets"
% (maybe(ecr["examined-shares"]), maybe(ecr["examined-buckets"])))
add("and to recover: ", self.format_recovered(ecr, "actual"))
else:
add("If expiration were enabled, we would have recovered: ",
self.format_recovered(sr, "configured"), " by now")
add("and the remainder of this cycle would probably recover: ",
self.format_recovered(esr, "configured"))
add("and the whole cycle would probably recover: ",
self.format_recovered(ecr, "configured"))
add("if we were strictly using each lease's default 31-day lease lifetime "
"(instead of our configured behavior), "
"this cycle would be expected to recover: ",
self.format_recovered(ecr, "original"))
if so_far["corrupt-shares"]:
add("Corrupt shares:",
T.ul[ [T.li[ ["SI %s shnum %d" % corrupt_share
for corrupt_share in so_far["corrupt-shares"] ]
]]])
return ctx.tag["Current cycle:", p]
开发者ID:GunioRobot,项目名称:tahoe-lafs,代码行数:56,代码来源:storage.py
示例14: render_server_timings
def render_server_timings(self, ctx, data):
per_server = self.publish_status.timings.get("send_per_server")
if not per_server:
return ""
l = T.ul()
for server in sorted(per_server.keys(), key=lambda s: s.get_name()):
times_s = ", ".join([self.render_time(None, t)
for t in per_server[server]])
l[T.li["[%s]: %s" % (server.get_name(), times_s)]]
return T.li["Per-Server Response Times: ", l]
开发者ID:wwaites,项目名称:tahoe-lafs,代码行数:10,代码来源:status.py
示例15: render_server_timings
def render_server_timings(self, ctx, data):
per_server = self.publish_status.timings.get("send_per_server")
if not per_server:
return ""
l = T.ul()
for peerid in sorted(per_server.keys()):
peerid_s = idlib.shortnodeid_b2a(peerid)
times_s = ", ".join([self.render_time(None, t) for t in per_server[peerid]])
l[T.li["[%s]: %s" % (peerid_s, times_s)]]
return T.li["Per-Server Response Times: ", l]
开发者ID:GunioRobot,项目名称:tahoe-lafs,代码行数:10,代码来源:status.py
示例16: _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
示例17: data_identities
def data_identities(self, ctx, data):
"""
Template function to display a list of user identities.
"""
result = yield self.user.getIdentities()
output = [tags.h3()['identities'],
tags.ul(_class="url-list")[[
tags.li()[item['url']] for item in result
]]
]
returnValue(output)
开发者ID:iffy,项目名称:txOpenID,代码行数:11,代码来源:resource.py
示例18: data_trusted_roots
def data_trusted_roots(self, ctx, data):
"""
Template function to display a list of user roots.
"""
result = yield self.user.getTrustedRoots()
output = [tags.h3()['trusted roots'],
tags.ul(_class="url-list")[[
tags.li()[item['url']] for item in result
]]
]
returnValue(output)
开发者ID:iffy,项目名称:txOpenID,代码行数:11,代码来源:resource.py
示例19: moduleSummary
def moduleSummary(modorpack):
r = tags.li[taglink(modorpack), ' - ', epydoc2stan.doc2html(modorpack, summary=True)[0]]
if not isinstance(modorpack, model.Package):
return r
contents = [m for m in modorpack.orderedcontents
if m.isVisible and m.name != '__init__']
if not contents:
return r
ul = tags.ul()
for m in sorted(contents, key=lambda m:m.fullName()):
ul[moduleSummary(m)]
return r[ul]
开发者ID:davidsansome,项目名称:babbledrive,代码行数:12,代码来源:summary.py
示例20: 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
注:本文中的nevow.tags.ul函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论