本文整理汇总了Python中model.Page.get_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Page.get_by_id方法的具体用法?Python Page.get_by_id怎么用?Python Page.get_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Page
的用法示例。
在下文中一共展示了Page.get_by_id方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: exchange
# 需要导入模块: from model import Page [as 别名]
# 或者: from model.Page import get_by_id [as 别名]
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()
示例2: get_file
# 需要导入模块: from model import Page [as 别名]
# 或者: from model.Page import get_by_id [as 别名]
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)
示例3: getPageParent
# 需要导入模块: from model import Page [as 别名]
# 或者: from model.Page import get_by_id [as 别名]
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;
示例4: delete_page
# 需要导入模块: from model import Page [as 别名]
# 或者: from model.Page import get_by_id [as 别名]
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)
示例5: get
# 需要导入模块: from model import Page [as 别名]
# 或者: from model.Page import get_by_id [as 别名]
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')
示例6: linkNodeDelete
# 需要导入模块: from model import Page [as 别名]
# 或者: from model.Page import get_by_id [as 别名]
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;
示例7: getParent
# 需要导入模块: from model import Page [as 别名]
# 或者: from model.Page import get_by_id [as 别名]
def getParent(self):
parent = None;
if self.ID:
parent = Page.get_by_id(self.ID);
return parent;