def _get_id(cls, obj):
if cls._is_ndb():
if not isinstance(obj, ndb.Key):
# Turn objects into keys
key = obj.key
else:
key = obj
obj_id = key.string_id()
else:
if not isinstance(obj, db.Key):
# Turn objects into keys
key = obj.key()
else:
key = obj
obj_id = key.name()
return obj_id
评论列表
文章目录