本文整理汇总了Python中MoinMoin.PageEditor.PageEditor.get_rev方法的典型用法代码示例。如果您正苦于以下问题:Python PageEditor.get_rev方法的具体用法?Python PageEditor.get_rev怎么用?Python PageEditor.get_rev使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoinMoin.PageEditor.PageEditor
的用法示例。
在下文中一共展示了PageEditor.get_rev方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save_page
# 需要导入模块: from MoinMoin.PageEditor import PageEditor [as 别名]
# 或者: from MoinMoin.PageEditor.PageEditor import get_rev [as 别名]
def save_page(self, output):
editor = PageEditor(self.macro.request, self.pagename)
text = self.create_header()
text += editor.normalizeText(output)
dummy, revision, exists = editor.get_rev()
try:
res = editor.saveText(text, revision, comment="updated by MakeList macro.")
return res
except editor.Unchanged:
return "You did not change the page content, not saved!"
except:
return "An error occured!"
示例2: newday
# 需要导入模块: from MoinMoin.PageEditor import PageEditor [as 别名]
# 或者: from MoinMoin.PageEditor.PageEditor import get_rev [as 别名]
def newday (Wiki, ParentPage, TemplatePage, NewPage, Editor, UidName, GidName):
from os import seteuid,setegid
from pwd import getpwnam
from grp import getgrnam
uid = getpwnam(UidName).pw_uid
gid = getgrnam(GidName).gr_gid
setegid(gid)
seteuid(uid)
from MoinMoin.PageEditor import PageEditor
from MoinMoin.Page import Page
from MoinMoin.user import getUserId, User
from MoinMoin.web.contexts import ScriptContext
PageName = "%s/%s" % (ParentPage,NewPage)
RequestPage = ScriptContext(Wiki, PageName)
UserId = getUserId(RequestPage, Editor)
RequestPage.user = User(RequestPage, UserId)
Editor = PageEditor(RequestPage, PageName)
Dummy, Revision, Exists = Editor.get_rev()
if not Exists:
RequestTemplate = ScriptContext(Wiki, TemplatePage)
Viewer = Page(RequestTemplate, TemplatePage)
Text = Viewer.getPageText().replace("@[email protected]", NewPage)
Header = Viewer.getPageHeader()
Text=Header+Text
return Editor.saveText(Text, Revision)
示例3: ScriptContext
# 需要导入模块: from MoinMoin.PageEditor import PageEditor [as 别名]
# 或者: from MoinMoin.PageEditor.PageEditor import get_rev [as 别名]
# coding: utf-8
import py
from MoinMoin import wikiutil
from MoinMoin.PageEditor import PageEditor
from MoinMoin.web.contexts import ScriptContext
pagename = 'Class_%23AC0'
req = ScriptContext('localhost:8080', pagename)
editor = PageEditor(request, pagename)
text = editor.normalizeText('''= #AC<sup>0</sup> =
The class of functions from {0,1}<sup>n</sup> to nonnegative integers computed by polynomial-size constant-depth arithmetic circuits, using addition and multiplication gates and the constants 0 and 1.
Contained in GapAC<sup>0</sup>.''')
_, rev, _ = editor.get_rev()
editor.saveText(text, rev)