本文整理汇总了Python中model.Page类的典型用法代码示例。如果您正苦于以下问题:Python Page类的具体用法?Python Page怎么用?Python Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Page类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: exchange
def exchange(self):
params = self.request.params
page1 = Page.get_by_id(params.get('page1'), parent=self.master_key)
page2 = Page.get_by_id(params.get('page2'), parent=self.master_key)
page1.order, page2.order = page2.order, page1.order
page1.put()
page2.put()
开发者ID:Jarlax,项目名称:gae-site,代码行数:7,代码来源:handlers.py
示例2: save
def save(self):
params = self.request.params
page = Page.get_or_create(params.get('id'), self._get_parent_key())
page.mergeProps(params)
if page.order is None:
page.order = Page.get_children_count(self.master_key)
page.put()
self.redirect(self._redirect_url(page))
开发者ID:Jarlax,项目名称:gae-site,代码行数:8,代码来源:handlers.py
示例3: delete_page
def delete_page(self, page_id):
page = Page.get_by_id(page_id, parent=self.master_key)
if page:
Page.dec_order_number(self.master_key, page.order)
page.key.delete()
self.redirect(self._redirect_url())
else:
self.error(404)
开发者ID:Jarlax,项目名称:gae-site,代码行数:8,代码来源:handlers.py
示例4: get
def get(self, page_id=''):
if page_id:
page = Page.get_by_id(page_id, parent=self.master_key)
else:
page = Page.get_first_child(self.master_key, False)
if page:
return self._get_page(page)
else:
self.redirect('/_add?type=post')
开发者ID:Jarlax,项目名称:gae-site,代码行数:9,代码来源:handlers.py
示例5: post
def post(self, pid):
try:
page = Page.get(id = pid)
except:
self.flash("此栏目不存在")
self.redirect("/admin/pages")
return
name = self.get_argument("name", None)
slug = self.get_argument("slug", None)
content = self.get_argument("content", "")
template = self.get_argument("template", "staticpage.html")
page.name = name
page.slug = slug
page.content = content
page.template = template
try:
page.validate()
page.save()
self.flash(u"栏目%s修改成功" % name)
self.redirect("/admin/pages")
return
except Exception, ex:
self.flash(str(ex))
开发者ID:FashtimeDotCom,项目名称:cakeshop,代码行数:27,代码来源:admin.py
示例6: __init__
def __init__(self):
self.structure = {}
pages = Page.find()
for page in pages:
if page.attr['title'] != 'index':
self.structure[page.attr['title']] = \
{"_type": "button", "data": {"href": '/%s' % page.attr['title']}}
开发者ID:Alston-Tang,项目名称:REIC,代码行数:7,代码来源:nav_bar.py
示例7: get
def get(self, link):
page = Page.by_path(link)
params = {}
if self.user and page:
params = {
'name': self.user.username,
'name_ev': 'edit',
'name_lio': 'logout',
'link_ev': self.uri_for('edit', link=link),
'link_lio': self.uri_for('logout')
}
elif not self.user and page:
params = {
'name_lio': 'login',
'link_lio': self.uri_for('login')
}
else:
return self.redirect_to('edit', link=link)
self.render_response(self.template, page=page, params=params)
开发者ID:PropheticBird,项目名称:wiki,代码行数:26,代码来源:wiki_page.py
示例8: getPage
def getPage(self, id):
"""Return a Page object
@type id: string, or Page object
@param id: page id, or Page object
@rtype: Page"""
return Page.create(self.pm_getSpaceManager().getPage(self._unbox(id)), self._modelDataManager)
开发者ID:racktivity,项目名称:ext-pylabs-core,代码行数:7,代码来源:ConfluenceImpl.py
示例9: get_file
def get_file(self, file_id):
page = Page.get_by_id(file_id, parent=self.master_key)
if page and page.file_content:
self.response.headers['Content-Type'] = str(page.file_type)
self.response.write(page.file_content)
else:
self.error(404)
开发者ID:Jarlax,项目名称:gae-site,代码行数:7,代码来源:handlers.py
示例10: editPage
def editPage(self, page):
"""Update content of page
@type page: Page object
@param page: Page object having the updated content
@rtype: Page
@return: updated Page"""
return Page.create(self.pm_getSpaceManager().editPage(page.toDict()), self._modelDataManager)
开发者ID:racktivity,项目名称:ext-pylabs-core,代码行数:8,代码来源:ConfluenceImpl.py
示例11: findPage
def findPage(self, space, title):
"""Return a Page object
@type space: string, or Space object
@param space: space key, or Space object
@param title: the title of the page
@rtype: Page"""
return Page.create(self.pm_getSpaceManager().findPage(self._unbox(space), title), self._modelDataManager)
开发者ID:racktivity,项目名称:ext-pylabs-core,代码行数:8,代码来源:ConfluenceImpl.py
示例12: listPages
def listPages(self, space):
"""Return a list of available pages in this space
@type space: string, or Space Object
@param space: space key, or Space object
@rtype: Page list
@return: list of Pages contained in space"""
return tuple(Page.create(page, self._modelDataManager) for page in self.pm_getSpaceManager().listPages(self._unbox(space)))
开发者ID:racktivity,项目名称:ext-pylabs-core,代码行数:8,代码来源:ConfluenceImpl.py
示例13: getPageParent
def getPageParent(self,page):#get parent from its page
if page:
my_key = page.parent;
if my_key:
PID = my_key.id();
parent = Page.get_by_id(PID);
return parent;
return;
开发者ID:straightDeveloper,项目名称:sec-blog,代码行数:8,代码来源:blog.py
示例14: get
def get(self, pid):
try:
page = Page.get(id = pid)
except:
self.flash("此栏目不存在")
self.redirect("/admin/pages")
return
self.render('admin/editpage.html', page = page)
开发者ID:FashtimeDotCom,项目名称:cakeshop,代码行数:8,代码来源:admin.py
示例15: get
def get(self, slug):
try:
page = Page.get(slug = slug)
except:
raise HTTPError(404)
return
self.render("static/%s" % page.template, page = page)
开发者ID:FashtimeDotCom,项目名称:cakeshop,代码行数:8,代码来源:site.py
示例16: linkNodeDelete
def linkNodeDelete(ID):
link = None;
if ID:
link = Page.get_by_id(ID);
myKey = None;
if link:
myKey = link.key;
for m in Page.query(Page.parent == myKey):
linkDelete(m.key.id());
for m in Post.query(Post.parent == myKey):
m.key.delete();
return link;
开发者ID:straightDeveloper,项目名称:sec-blog,代码行数:18,代码来源:blog.py
示例17: add_page
def add_page(self):
params = self.request.params
order = params.get('order', Page.get_children_count(self.master_key))
parent = self._get_parent_key()
page_type = params.get('type', None)
if page_type:
page = Page(parent=parent, page_type=page_type, order=int(order))
self._get_page(page)
else:
self.error(400)
开发者ID:Jarlax,项目名称:gae-site,代码行数:10,代码来源:handlers.py
示例18: createPageFromFile
def createPageFromFile(self, localFilePath, space, title = None, parentId = None, addFileAsAttachment = False):
"""Create a page and add the localFilePath path content as the page content
@param localPath: the path of the file on local machine containing the wiki text to be used as new page content
@type space: string , or Space object
@param space: space key, or Space object
@param title: page title(if default value, the file name will be used as a title)
@param parentId: the page id of the parent page (if default value, the page has no parent)
@param addFileAsAttachment: if True, the file specified is added as attachment to the page(if default value, no attachment is created)
@rtype: Page
@return: newly created Page"""
return Page.create(self.pm_getSpaceManager().createPageFromFile(localFilePath, self._unbox(space), title, parentId, addFileAsAttachment), self._modelDataManager)
开发者ID:racktivity,项目名称:ext-pylabs-core,代码行数:12,代码来源:ConfluenceImpl.py
示例19: addPage
def addPage(self, space, title, parent = None, content = ''):
"""Create a Page
@type space: string, or Space object
@param space: space key, or Space object
@param title: page title
@type parent: string, or Page object
@param parent: the page id of the parent page, or Page object of the parent page(if not passed the page has no parent)
@param content: page content written as wiki text
@rtype: Page
@return: newly created Page"""
return Page.create(self.pm_getSpaceManager().addPage(self._unbox(space), title, self._unbox(parent), content), self._modelDataManager)
开发者ID:racktivity,项目名称:ext-pylabs-core,代码行数:12,代码来源:ConfluenceImpl.py
示例20: _get_page
def _get_page(self, page):
master = 'admin' if users.is_current_user_admin() else 'public'
menu_pages = Page.get_children_names(self.master_key, False)
values = {
'id': page.key.string_id(),
'master': master + '.html',
'menu': menu_pages,
'page': page,
'site_name': site_name
}
template = JINJA_ENV.get_template(page.page_type + '.html')
self.response.write(template.render(values))
开发者ID:Jarlax,项目名称:gae-site,代码行数:12,代码来源:handlers.py
注:本文中的model.Page类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论