本文整理匯總了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;