本文整理汇总了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))