本文整理汇总了Python中MoinMoin.Page.Page.isConflict方法的典型用法代码示例。如果您正苦于以下问题:Python Page.isConflict方法的具体用法?Python Page.isConflict怎么用?Python Page.isConflict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoinMoin.Page.Page
的用法示例。
在下文中一共展示了Page.isConflict方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: format_page_edits
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import isConflict [as 别名]
def format_page_edits(macro, lines, bookmark_usecs):
request = macro.request
_ = request.getText
d = {} # dict for passing stuff to theme
line = lines[0]
pagename = line.pagename
rev = int(line.rev)
tnow = time.time()
is_new = lines[-1].action == "SAVENEW"
is_renamed = lines[-1].action == "SAVE/RENAME"
# check whether this page is newer than the user's bookmark
hilite = line.ed_time_usecs > (bookmark_usecs or line.ed_time_usecs)
page = Page(request, pagename)
html_link = ""
if not page.exists():
img = request.theme.make_icon("deleted")
revbefore = rev - 1
if revbefore and page.exists(rev=revbefore, domain="standard"):
# indicate page was deleted and show diff to last existing revision of it
html_link = page.link_to_raw(request, img, querystr={"action": "diff"}, rel="nofollow")
else:
# just indicate page was deleted
html_link = img
elif page.isConflict():
img = request.theme.make_icon("conflict")
html_link = page.link_to_raw(request, img, querystr={"action": "edit"}, rel="nofollow")
elif hilite:
# show special icons if change was after the user's bookmark
if is_new:
img = "new"
elif is_renamed:
img = "renamed"
else:
img = "updated"
img = request.theme.make_icon(img)
html_link = page.link_to_raw(
request, img, querystr={"action": "diff", "date": "%d" % bookmark_usecs}, rel="nofollow"
)
else:
# show "DIFF" icon else
img = request.theme.make_icon("diffrc")
html_link = page.link_to_raw(request, img, querystr={"action": "diff"}, rel="nofollow")
# print name of page, with a link to it
force_split = len(page.page_name) > _MAX_PAGENAME_LENGTH
d["icon_html"] = html_link
d["pagelink_html"] = page.link_to(request, text=page.split_title(force=force_split))
# print time of change
d["time_html"] = None
if request.cfg.changed_time_fmt:
tdiff = long(tnow - wikiutil.version2timestamp(long(line.ed_time_usecs))) / 60 # has to be long for py 2.2.x
if tdiff < 100:
d["time_html"] = _("%(mins)dm ago") % {"mins": tdiff}
else:
d["time_html"] = time.strftime(request.cfg.changed_time_fmt, line.time_tuple)
# print editor name or IP
d["editors"] = None
if request.cfg.show_names:
if len(lines) > 1:
counters = {}
editorcache = {}
for idx in range(len(lines)):
editorkey = lines[idx].addr, lines[idx].hostname, lines[idx].userid
if editorkey not in editorcache:
editorcache[editorkey] = lines[idx].getEditor(request)
name = editorcache[editorkey]
if not name in counters:
counters[name] = []
counters[name].append(idx + 1)
poslist = [(v, k) for k, v in counters.items()]
poslist.sort()
d["editors"] = []
for positions, name in poslist:
d["editors"].append("%s [%s]" % (name, util.rangelist(positions)))
else:
d["editors"] = [line.getEditor(request)]
comments = []
for idx in range(len(lines)):
comment = format_comment(request, lines[idx])
if comment:
comments.append((idx + 1, wikiutil.escape(comment)))
d["changecount"] = len(lines)
d["comments"] = comments
img = request.theme.make_icon("info")
d["info_html"] = page.link_to_raw(request, img, querystr={"action": "info"}, rel="nofollow")
return request.theme.recentchanges_entry(d)
示例2: format_page_edits
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import isConflict [as 别名]
def format_page_edits(macro, lines, bookmark_usecs):
request = macro.request
_ = request.getText
d = {} # dict for passing stuff to theme
line = lines[0]
pagename = line.pagename
rev = int(line.rev)
tnow = time.time()
is_new = lines[-1].action == 'SAVENEW'
is_renamed = lines[-1].action == 'SAVE/RENAME'
# check whether this page is newer than the user's bookmark
hilite = line.ed_time_usecs > (bookmark_usecs or line.ed_time_usecs)
page = Page(request, pagename)
html_link = ''
if not page.exists():
img = request.theme.make_icon('deleted')
revbefore = rev - 1
if revbefore and page.exists(rev=revbefore, domain='standard'):
# indicate page was deleted and show diff to last existing revision of it
html_link = page.link_to_raw(request, img, querystr={'action': 'diff'}, rel='nofollow')
else:
# just indicate page was deleted
html_link = img
elif page.isConflict():
img = request.theme.make_icon('conflict')
html_link = page.link_to_raw(request, img, querystr={'action': 'edit'}, rel='nofollow')
elif hilite:
# show special icons if change was after the user's bookmark
if is_new:
img = 'new'
elif is_renamed:
img = 'renamed'
else:
img = 'updated'
img = request.theme.make_icon(img)
html_link = page.link_to_raw(request, img, querystr={'action': 'diff', 'date': '%d' % bookmark_usecs}, rel='nofollow')
else:
# show "DIFF" icon else
img = request.theme.make_icon('diffrc')
html_link = page.link_to_raw(request, img, querystr={'action': 'diff'}, rel='nofollow')
# print name of page, with a link to it
force_split = len(page.page_name) > _MAX_PAGENAME_LENGTH
d['icon_html'] = html_link
d['pagelink_html'] = page.link_to(request, text=page.split_title(force=force_split))
# print time of change
d['time_html'] = None
if request.cfg.changed_time_fmt:
tdiff = long(tnow - wikiutil.version2timestamp(long(line.ed_time_usecs))) / 60 # has to be long for py 2.2.x
if tdiff < 100:
d['time_html'] = _("%(mins)dm ago") % {
'mins': tdiff}
else:
d['time_html'] = time.strftime(request.cfg.changed_time_fmt, line.time_tuple)
# print editor name or IP
d['editors'] = None
if request.cfg.show_names:
if len(lines) > 1:
counters = {}
for idx in range(len(lines)):
name = lines[idx].getEditor(request)
if not name in counters:
counters[name] = []
counters[name].append(idx+1)
poslist = [(v, k) for k, v in counters.items()]
poslist.sort()
d['editors'] = []
for positions, name in poslist:
d['editors'].append("%s [%s]" % (
name, util.rangelist(positions)))
else:
d['editors'] = [line.getEditor(request)]
comments = []
for idx in range(len(lines)):
comment = format_comment(request, lines[idx])
if comment:
comments.append((idx+1, wikiutil.escape(comment)))
d['changecount'] = len(lines)
d['comments'] = comments
img = request.theme.make_icon('info')
d['info_html'] = page.link_to_raw(request, img, querystr={'action': 'info'}, rel='nofollow')
return request.theme.recentchanges_entry(d)