本文整理汇总了Python中models.Page.getName方法的典型用法代码示例。如果您正苦于以下问题:Python Page.getName方法的具体用法?Python Page.getName怎么用?Python Page.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Page
的用法示例。
在下文中一共展示了Page.getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Page [as 别名]
# 或者: from models.Page import getName [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: get
# 需要导入模块: from models import Page [as 别名]
# 或者: from models.Page import getName [as 别名]
def get(self, name):
"""Handles the get requests for the page API
If a version is specified in the url it retreives the corresponding version
of the requested page.
If the requested version or page doesn't exist, a 404 will be served.
"""
name = utils.checkPage(name)
version = self.checkVersionRequest()
page = Page.getName(name, version)
if page:
self.renderJson(page.to_dict(exclude=["name"]))
else:
self.abort(404)