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)
def get(self): next = None PAGESIZE = 30 util.insertUsersideCookies(self) user = UserInfo() user.whoIs(self) if user.email == '*****@*****.**': self.generate('limboPage.html') return; bookmark = self.request.get("bookmark") if bookmark: bookmark = Key(self.request.get("bookmark")) else: bookmark = Key.from_path('GallerySketch',SKETCH_ZEROS) logging.info('starting key ' + str(bookmark)) logging.info('starting key name' + bookmark.name()) q = db.GqlQuery("SELECT * FROM GallerySketch WHERE __key__ >= :1", bookmark) 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':"gallery", 'headerTitle':"Gallery", } self.generate('galleryTemplate.html',template_values)