本文整理汇总了Python中nevow.tags.a函数的典型用法代码示例。如果您正苦于以下问题:Python a函数的具体用法?Python a怎么用?Python a使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了a函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: data_header
def data_header(self, ctx, data):
u=url.URL.fromContext(ctx)
u=u.parentdir().parentdir().clear()
l=[]
l.append(tags.a(href=u.sibling("search"))[_("Search")])
l.append(tags.a(href=u.sibling("add"))[_("add new entry")])
return l
示例2: data_header
def data_header(self, ctx, data):
u=url.URL.fromContext(ctx).up().clear()
l=[]
l.append(tags.a(href=u.sibling("search"))[_("Search")])
l.append(tags.a(href=u.sibling("add"))[_("add new entry")])
l.append(tags.a(href=u.sibling("edit").child(str(self.dn)))[_("edit")])
return l
示例3: render_downloadtable
def render_downloadtable(self, ctx, data):
rows = []
for packageName, version, release, md5, download, release_notes in \
data:
download_link = T.a(href = download)["Download %s" % version]
release_notes_link = T.a(href = release_notes)["%s release notes" % version]
tr = T.tr[
T.td[packageName],
T.td[version],
T.td[release],
T.td[md5],
T.td[download_link],
]
if release_notes:
tr[T.td[release_notes_link]]
rows.append(tr)
return ctx.tag[
T.thead[T.tr[
T.td["Package"],
T.td["Version number"],
T.td["Release date"],
T.td["MD5 sum"],
T.td["Download link"],
T.td["Release Notes"]
]],
T.body[rows]
]
示例4: gotItems
def gotItems(items,categories):
categoryCMSItems = {}
for item in items:
i = item.getProtectedObject()
categoryCMSItems[i.name] = i
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 = ''
html = [
T.h4[
T.a(href=url.here.up().child(name))[
title
]
],
T.p[
T.a(href=url.here.up().child(name))[
shortDescription
]
]
]
yield html
示例5: render_menu
def render_menu(self, ctx, data):
request = inevow.IRequest(ctx)
username = request.getUser()
ret = tags.table(border=0, cellspacing=3, cellpadding=3)
row = tags.tr(valign="middle")
row[tags.td(_class="menuentry", width="150", align="center",
onclick="self.location='/account/'",
onmouseover="this.className='menuentrypressed';",
onmouseout="this.className='menuentry';")
[tags.a(_class="menuentry", href="/account/")["Account"]]]
if config.admins.count(username) > 0:
row[tags.td(_class="menuentry", width="150", align="center",
onclick="self.location='/status/'",
onmouseover="this.className='menuentrypressed';",
onmouseout="this.className='menuentry';")
[tags.a(_class="menuentry", href="/status/")["Status"]]]
row[tags.td(_class="menuentry", width="150", align="center",
onclick="self.location='/config/'",
onmouseover="this.className='menuentrypressed';",
onmouseout="this.className='menuentry';")
[tags.a(_class="menuentry", href="/config/")["Configuration"]]]
row[tags.td(_class="menuentry", width="150", align="center",
onclick="self.location='/controls/'",
onmouseover="this.className='menuentrypressed';",
onmouseout="this.className='menuentry';")
[tags.a(_class="menuentry", href="/controls/")["Controls"]]]
return ret
示例6: render_index_players
def render_index_players(self, ctx, data):
data.sort(key=attrgetter('name'))
lines = []
for player in data:
line = []
name = player.name
tzid = player.tzid
tzidcell = T.td(_class="objtzid")[tzid, ':']
line.append(tzidcell)
if admin.verify(player):
line.append(T.td['!'])
elif wizard.verify(player):
line.append(T.td['@'])
else:
line.append(T.td)
editlink = T.a(href="/edit/%s" % tzid)[name]
line.append(T.td(_class="objname")[editlink])
if player.logged_in:
room = player.room
editlink = "/edit/%s" % room.tzid
link = T.a(href=editlink)[T.span(_class="editlink")[room.name]]
line.append(T.td[link])
else:
line.append(T.td)
lines.append(T.tr[line])
return T.table[lines]
示例7: 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 ]
示例8: 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]
示例9: render_listsheets
def render_listsheets(self,ctx):
return [T.div[
T.span(style="font-weight:bold;")[
T.a(href=i[0])[i[1]]],' located at ',
T.a(href=i[0])[i[0]]
] for i in self.emailInfo]
示例10: render_status
def render_status(self, context, data):
try:
obj = context.locate(inevow.IHand)
except KeyError:
return context.tag.clear()
if not isinstance(obj, EditStatus):
return context.tag.clear()[obj]
u=url.URL.fromContext(context)
u=u.parentdir().parentdir().clear()
return context.tag.clear()[
_("Edited "),
tags.a(href=u.parentdir()
.child(obj.entry.dn)
.child("search"))[obj.entry.dn],
_(" successfully. "),
# TODO share implementation with entryLinks
'[',
tags.a(href=u.sibling('move').child(uriQuote(obj.entry.dn)))[_('move')],
'|',
tags.a(href=u.sibling('delete').child(uriQuote(obj.entry.dn)))[_('delete')],
'|',
tags.a(href=u.sibling('change_password').child(uriQuote(obj.entry.dn)))[_('change password')],
']',
tags.p[obj.changes],
]
示例11: render_random
def render_random(self, ctx, data):
for randRow in randomSet(self.graph, 3):
print 'randRow', randRow
current = randRow['uri']
bindings = {"pic" : current}
tags = [[T.a(href=['/set?tag=', row['tag']])[row['tag']], ' ']
for row in self.graph.queryd(
"""SELECT DISTINCT ?tag WHERE {
?pic scot:hasTag [
rdfs:label ?tag ]
}""", initBindings=bindings)]
depicts = [[T.a(href=localSite(row['uri']))[row['label']], ' ']
for row in self.graph.queryd("""
SELECT DISTINCT ?uri ?label WHERE {
?pic foaf:depicts ?uri .
?uri rdfs:label ?label .
}""", initBindings=bindings)]
# todo: description and tags would be good too, and some
# other service should be rendering this whole section
yield T.div(class_="randPick")[
T.a(href=['/set?',
urllib.urlencode(dict(date=randRow['date'],
current=current))])[
T.img(src=[localSite(current), '?size=medium']),
],
T.div[tags],
T.div[depicts],
T.div[randRow['filename'].replace('/my/pic/','')],
]
示例12: render_langs
def render_langs(self, ctx, data):
"""Render a list of links to select from the available translations.
"""
out = [T.a(href=url.here.remove("lang"))["default"], " | "]
for lang in langs:
out.append(T.a(href=url.here.replace("lang", lang))[lang])
out.append(" | ")
return out[:-1]
示例13: render_footer
def render_footer(self, ctx, data):
ctx.fillSlots('blog_path',
T.a(href="http://blog.%s/" % self.app.servers.httpserver._cfg_site_domain)[ "blog" ]
)
ctx.fillSlots('blog_path',
T.a(href="http://blog.%s/" % self.app.servers.httpserver._cfg_site_domain)[ "blog" ]
)
return ctx
示例14: 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 ]
示例15: render_todo
def render_todo(self, ctx, data):
deluri = "freeform_post!!delete?id="+str(data[0])
updateuri = "freeform_post!!update?id="+str(data[0])+"&oldstate="+str(data[2])
state = [" Done", " To Do"][int(data[2])==0]
tag = ctx.tag
if data[2]:
tag = ctx.tag(_class="done")
return tag[data[1]+" - ",
t.a(href=deluri)["Delete"], " / ",
t.a(href=updateuri)[("Mark Done", "Mark Undone")[data[2]]],
state]