本文整理汇总了Python中google.appengine.ext.db.Key.kind方法的典型用法代码示例。如果您正苦于以下问题:Python Key.kind方法的具体用法?Python Key.kind怎么用?Python Key.kind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类google.appengine.ext.db.Key
的用法示例。
在下文中一共展示了Key.kind方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from google.appengine.ext.db import Key [as 别名]
# 或者: from google.appengine.ext.db.Key import kind [as 别名]
def get(self, key):
k = Key(encoded=key)
if k.kind() == 'NearWooCampaignDS':
logging.info('is this camp?????')
camp_obj = models.NearWooCampaignDS.urlsafe_get(key)
camp = camp_obj.to_dict()
# logging.info(camp.to_dict())
elif k.kind() == 'YelpJsonDS':
yelp = models.YelpJsonDS.urlsafe_get(key)
camp = models.NearWooCampaignDS.urlsafe_get(yelp.campaign_key)
elif k.kind() == 'Advertiser':
camp = models.NearWooCampaignDS.gql(
'where advertiser_key = :1', key).fetch(1000)
else:
camp = None
if not camp:
m = "Camp Entity cannot be retrieved with given key"
msg = make_status_message(success=False, message=m,
code=500, data=None)
self.response.write(msg)
else:
result = None
if type(camp) == list:
result = []
for c in camp:
result.append(c.to_dict())
else:
result = camp
msg = make_status_message(
success=True, message='successfully retrieved',
code=200, data=result)
self.response.write(msg)