本文整理匯總了Python中Helper.Helper.getItemKey方法的典型用法代碼示例。如果您正苦於以下問題:Python Helper.getItemKey方法的具體用法?Python Helper.getItemKey怎麽用?Python Helper.getItemKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Helper.Helper
的用法示例。
在下文中一共展示了Helper.getItemKey方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: post
# 需要導入模塊: from Helper import Helper [as 別名]
# 或者: from Helper.Helper import getItemKey [as 別名]
def post(self):
itemName = self.request.get("itemName")
categoryName = self.request.get("categoryName")
userEmail = self.request.get("userEmail")
comment = self.request.get("comment")
owner = self.request.get("owner")
comment = str(comment).strip()
message = ""
if comment:
ifAlreadyExists = []
#self.response.out.write("Key is "+ str(Helper.getItemKey(userEmail, categoryName, itemName)))
ifAlreadyExists = ItemComment.gql("WHERE ANCESTOR IS :1",Helper.getItemKey(userEmail, categoryName, itemName))
#self.response.out.write("Key is "+ str(Helper.getItemKey(userEmail, categoryName, itemName)))
#self.response.out.write("Count is "+ str(ifAlreadyExists.count()))
if (ifAlreadyExists.count() == 0):
#self.response.out.write("Adding comment for " + itemName + " " + categoryName + " " + userEmail)
itemComment = ItemComment(parent=Helper.getItemKey(userEmail, categoryName, itemName))
itemComment.comment = comment
itemComment.commenter = userEmail
itemComment.item = itemName
itemComment.category = categoryName
itemComment.put()
message="Comment Saved"
else:
message="You can comment only once on an item"
else:
#self.response.out.write("empty comment")
message = "Cannot enter empty comment"
items = Item.gql("WHERE ANCESTOR IS :1",Helper.getCategoryKey(owner, categoryName))
template_values = {
'items' : items,
'owner': owner,
'user' : users.get_current_user(),
'category' : categoryName,
'logoutURL' : users.create_logout_url('./'),
'message' : message
}
path = os.path.join(os.path.dirname(__file__), './html/items.html')
self.response.out.write(template.render(path, template_values))