本文整理汇总了Python中models.Page.createPage方法的典型用法代码示例。如果您正苦于以下问题:Python Page.createPage方法的具体用法?Python Page.createPage怎么用?Python Page.createPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Page
的用法示例。
在下文中一共展示了Page.createPage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Page [as 别名]
# 或者: from models.Page import createPage [as 别名]
def get(self, name):
"""Handles the get requests for edit page of the wiki pages
The user will get redirected to the SignupPage if authentication fails.
If a version is specified in the url it retreives the corresponding version
of the requested page. If the version doesn't exists, it redirects to the
requested edit page without a version specified.
If no version is specified the latest version of the page will be retreived
to be displayed.
If there is no version of the page in the datastore, the requested name will
be transformed and used for Page.name.
"""
self.restrictedArea()
name = utils.checkPage(name)
version = self.request.get('v')
version = 0 if not version else int(version)
page = Page.getName(name, version)
if not page and version:
self.redirect('/_edit/%s' % name)
return None
if not page and not version:
page = Page.createPage(name)
params = { 'page': page }
self.render(settings.TEMPLATE_FILENAME['edit'], **params)
示例2: post
# 需要导入模块: from models import Page [as 别名]
# 或者: from models.Page import createPage [as 别名]
def post(self, name):
"""Handles the post requests for edit page of the wiki pages
The user will get redirected to the SignupPage if authentication fails.
The entity will be stored and the user gets redirected to the new version of
the page.
"""
self.restrictedArea()
name = utils.checkPage(name)
page = Page.createPage(name, self.request.get('content'), self.user.name)
page.put()
utils.addSearchIndex(page)
self.redirect('/%s' % name)