本文整理汇总了Python中MoinMoin.Page.Page.edit_info方法的典型用法代码示例。如果您正苦于以下问题:Python Page.edit_info方法的具体用法?Python Page.edit_info怎么用?Python Page.edit_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoinMoin.Page.Page
的用法示例。
在下文中一共展示了Page.edit_info方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: xmlrpc_getPageInfoVersion
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import edit_info [as 别名]
def xmlrpc_getPageInfoVersion(self, pagename, rev):
"""
Return page information for specific revision
@param pagename: the name of the page (utf-8)
@param rev: revision to get info about (int)
@rtype: dict
@return: page information
* name (string): the canonical page name, UTF-8.
* lastModified (date): Last modification date, UTC.
* author (string): author name, UTF-8.
* version (int): current version
"""
pn = self._instr(pagename)
# User may read this page?
if not self.request.user.may.read(pn):
return self.notAllowedFault()
if rev is not None:
page = Page(self.request, pn, rev=rev)
else:
page = Page(self.request, pn)
rev = page.current_rev()
# Non existing page?
if not page.exists():
return self.noSuchPageFault()
# Get page info
edit_info = page.edit_info()
if not edit_info:
return self.noLogEntryFault()
mtime = wikiutil.version2timestamp(long(edit_info['timestamp'])) # must be long for py 2.2.x
gmtuple = tuple(time.gmtime(mtime))
version = rev # our new rev numbers: 1,2,3,4,....
#######################################################################
# BACKWARDS COMPATIBILITY CODE - remove when 1.2.x is regarded stone age
# as we run a feed for BadContent on MoinMaster, we want to stay
# compatible here for a while with 1.2.x moins asking us for BadContent
# 1.3 uses the lastModified field for checking for updates, so it
# should be no problem putting the old UNIX timestamp style of version
# number in the version field
if self.request.cfg.sitename == 'MoinMaster' and pagename == 'BadContent':
version = int(mtime)
#######################################################################
return {
'name': self._outstr(page.page_name),
'lastModified': xmlrpclib.DateTime(gmtuple),
'author': self._outstr(edit_info['editor']),
'version': version,
}
示例2: _index_page_rev
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import edit_info [as 别名]
def _index_page_rev(self, request, connection, pagename, revno, mode='update'):
""" Index a page revision.
@param request: request suitable for indexing
@param connection: the Indexer connection object
@param pagename: the page name
@param revno: page revision number (int)
@param mode: 'add' = just add, no checks
'update' = check if already in index and update if needed (mtime)
"""
page = Page(request, pagename, rev=revno)
request.page = page # XXX for what is this needed?
wikiname = request.cfg.interwikiname or u"Self"
revision = str(page.get_real_rev())
itemid = "%s:%s:%s" % (wikiname, pagename, revision)
mtime = page.mtime_usecs()
doc = self._get_document(connection, itemid, mtime, mode)
logging.debug("%s %s %r" % (pagename, revision, doc))
if doc:
mimetype = 'text/%s' % page.pi['format'] # XXX improve this
fields = {}
fields['wikiname'] = wikiname
fields['pagename'] = pagename
fields['attachment'] = '' # this is a real page, not an attachment
fields['mtime'] = str(mtime)
fields['revision'] = revision
fields['title'] = pagename
fields['content'] = page.get_raw_body()
fields['lang'], fields['stem_lang'] = self._get_languages(page)
fields['author'] = page.edit_info().get('editor', '?')
multivalued_fields = {}
multivalued_fields['mimetype'] = [mt for mt in [mimetype] + mimetype.split('/')]
multivalued_fields['domain'] = self._get_domains(page)
multivalued_fields['linkto'] = page.getPageLinks(request)
multivalued_fields['category'] = self._get_categories(page)
self._add_fields_to_document(request, doc, fields, multivalued_fields)
try:
connection.replace(doc)
except xappy.IndexerError, err:
logging.warning("IndexerError at %r %r %r (%s)" % (
wikiname, pagename, revision, str(err)))
示例3: testEditInfoSystemPage
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import edit_info [as 别名]
def testEditInfoSystemPage(self):
# system pages have no edit-log (and only 1 revision),
# thus edit_info will return None
page = Page(self.request, u'RecentChanges')
edit_info = page.edit_info()
assert edit_info == {}