本文整理汇总了Python中Sycamore.Page.Page.date_to_version_number方法的典型用法代码示例。如果您正苦于以下问题:Python Page.date_to_version_number方法的具体用法?Python Page.date_to_version_number怎么用?Python Page.date_to_version_number使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sycamore.Page.Page
的用法示例。
在下文中一共展示了Page.date_to_version_number方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: display_edits
# 需要导入模块: from Sycamore.Page import Page [as 别名]
# 或者: from Sycamore.Page.Page import date_to_version_number [as 别名]
#.........这里部分代码省略.........
if count_result:
totalEdits = count_result[0]
request.cursor.execute("""SELECT count(DISTINCT name) from allPages
where userEdited=%(userid)s""",
{'userid':userid})
count_result = request.cursor.fetchone()
if count_result:
editedPages = count_result[0]
request.cursor.execute("""SELECT count(DISTINCT wiki_id) from allPages
where userEdited=%(userid)s""",
{'userid':userid})
wiki_count_result = request.cursor.fetchone()
if wiki_count_result:
editedWikis = wiki_count_result[0]
request.cursor.execute(
"""SELECT allPages.name, allPages.editTime, allPages.userIP,
allPages.editType, allPages.comment, wikis.name
from allPages, wikis
where allPages.userEdited=%(userid)s and
wikis.id=allPages.wiki_id
order by editTime desc limit 100 offset %(offset)s""",
{'userid':userid, 'offset':offset})
results = request.cursor.fetchall()
if results:
has_edits = True
count = 1
original_wiki = request.config.wiki_name
for edit in results:
this_edit = 1 + totalEdits - count - offset
pagename = edit[0]
mtime = edit[1]
userIp = '<a href="http://revip.info/ipinfo/%s" tooltip="%s">%s</a>' % (edit[2], edit[2], edit[2])
editType = edit[3]
comment = edit[4]
wiki_name = edit[5]
request.switch_wiki(wiki_name)
page = Page(pagename, request, wiki_name=wiki_name)
version = page.date_to_version_number(mtime)
if request.user.may.read(page):
may_read = True
show_page = page.link_to(
querystr='action=diff&version2=%s&version1=%s' %
(version, version-1),
guess_case=True, absolute=True)
formatted_mtime = request.user.getFormattedDateTime(mtime)
comment = Comment(request, comment, editType).render()
else:
may_read = False
show_page = """<em>hidden</em>"""
userIp = '<em>hidden</em>'
comment = '<em>hidden</em>'
formatted_mtime = '<em>hidden</em>'
if config.wiki_farm:
if may_read:
farm_link = farm.link_to_wiki(wiki_name, request.formatter)
else:
farm_link = '<em>hidden</em>'
edits.addRow((show_page,
farm_link,
formatted_mtime,
userIp,
comment))
else:
edits.addRow((show_page,
formatted_mtime,
userIp,
comment))
count += 1
request.switch_wiki(original_wiki)
if has_edits:
request.write('<p>This user has made <b>%d</b> edits to <b>%d</b> '
'pages' % (totalEdits, editedPages ))
if config.wiki_farm:
request.write(' on <b>%s</b> wikis' % editedWikis)
request.write('.</p>')
request.write('<div id="useredits">')
edit_table = DataBrowserWidget(request)
edit_table.setData(edits)
edit_table.render(append=printNextPrev(request, on_pagename, this_edit,
offset_given))
request.write('</div>')
request.write('<script type="text/javascript" src="/wiki/revipbox.js"></script>')
else:
request.write("<p>This user hasn't edited any pages.</p>")