本文整理汇总了Python中google.appengine.ext.db.Key.name方法的典型用法代码示例。如果您正苦于以下问题:Python Key.name方法的具体用法?Python Key.name怎么用?Python Key.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类google.appengine.ext.db.Key
的用法示例。
在下文中一共展示了Key.name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from google.appengine.ext.db import Key [as 别名]
# 或者: from google.appengine.ext.db.Key import name [as 别名]
def get(self):
next = None
PAGESIZE = 30
util.insertUsersideCookies(self)
self.session = True
user = UserInfo()
user.whoIs(self)
bookmark = self.request.get("bookmark")
if bookmark:
bookmark = Key(self.request.get("bookmark"))
else:
if user.user:
bookmark = Key.from_path('MySketchesSketch','-%023d' % (int(user.user_id)) + SKETCH_ZEROS)
else:
bookmark = Key.from_path('MySketchesSketch','-%023d' % (0) + SKETCH_ZEROS)
if user.user:
endKey = Key.from_path('MySketchesSketch','-%023d' % (int(user.user_id) + 1) + SKETCH_ZEROS)
else:
endKey = Key.from_path('MySketchesSketch','-%023d' % (1) + SKETCH_ZEROS)
logging.info('starting key ' + str(bookmark))
logging.info('starting key name' + bookmark.name())
q = db.GqlQuery("SELECT * FROM MySketchesSketch WHERE __key__ >= :1 AND __key__ < :2",bookmark,endKey)
sketches = q.fetch(PAGESIZE+1)
if len(sketches) == PAGESIZE + 1:
next = str(sketches[-1].key())
sketches = sketches[:PAGESIZE]
logging.info('next key ' + next)
logging.info('next key name ' + sketches[-1].key().name())
if next is None:
next = ""
for sketch in sketches:
sketch.stringtags = util.shorten(" ".join(sketch.tags),18)
template_values = {
'sketches':sketches,
'bookmark':bookmark,
'next':next,
'action':"mySketches",
'headerTitle':"My sketches",
}
self.generate('galleryTemplate.html',template_values)