本文整理汇总了Python中MoinMoin.Page.Page.editlog_entry方法的典型用法代码示例。如果您正苦于以下问题:Python Page.editlog_entry方法的具体用法?Python Page.editlog_entry怎么用?Python Page.editlog_entry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoinMoin.Page.Page
的用法示例。
在下文中一共展示了Page.editlog_entry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import editlog_entry [as 别名]
def execute(pagename, request):
""" Handle "action=diff"
checking for either a "rev=formerrevision" parameter
or rev1 and rev2 parameters
"""
if not request.user.may.read(pagename):
Page(request, pagename).send_page()
return
try:
date = request.values['date']
try:
date = long(date) # must be long for py 2.2.x
except StandardError:
date = 0
except KeyError:
date = 0
try:
rev1 = int(request.values.get('rev1', -1))
except StandardError:
rev1 = 0
try:
rev2 = int(request.values.get('rev2', 0))
except StandardError:
rev2 = 0
if rev1 == -1 and rev2 == 0:
rev1 = request.rev
if rev1 is None:
rev1 = -1
# spacing flag?
ignorews = int(request.values.get('ignorews', 0))
_ = request.getText
# get a list of old revisions, and back out if none are available
currentpage = Page(request, pagename)
currentrev = currentpage.current_rev()
if currentrev < 2:
request.theme.add_msg(_("No older revisions available!"), "error")
currentpage.send_page()
return
if date: # this is how we get called from RecentChanges
rev1 = 0
log = editlog.EditLog(request, rootpagename=pagename)
for line in log.reverse():
if date >= line.ed_time_usecs and int(line.rev) != 99999999:
rev1 = int(line.rev)
break
else:
rev1 = 1
rev2 = 0
if rev1 > 0 and rev2 > 0 and rev1 > rev2 or rev1 == 0 and rev2 > 0:
rev1, rev2 = rev2, rev1
if rev1 == -1:
oldrev = currentrev - 1
oldpage = Page(request, pagename, rev=oldrev)
elif rev1 == 0:
oldrev = currentrev
oldpage = currentpage
else:
oldrev = rev1
oldpage = Page(request, pagename, rev=oldrev)
if rev2 == 0:
newrev = currentrev
newpage = currentpage
else:
newrev = rev2
newpage = Page(request, pagename, rev=newrev)
oldlog = oldpage.editlog_entry()
newlog = newpage.editlog_entry()
if not oldlog or not newlog:
# We use "No log entries found." msg because we already have i18n
# for that. Better would "At least one log entry was not found.".
request.theme.add_msg(_("No log entries found."), "error")
currentpage.send_page()
return
edit_count = abs(newrev - oldrev)
# Start output
# This action generates content in the user language
request.setContentLanguage(request.lang)
request.theme.send_title(_('Diff for "%s"') % (pagename, ), pagename=pagename, allow_doubleclick=1)
f = request.formatter
request.write(f.div(1, id="content"))
oldrev = oldpage.get_real_rev()
newrev = newpage.get_real_rev()
#.........这里部分代码省略.........