def getSessionKeys(self, request): """Get websafe keys for all sessions""" # Query all sessions for thier websafe keys items = [] query = Session.query() for sess in query.fetch(): items.append([sess.sessionName, sess.key.urlsafe()]) # Create and send message with all keys and names keys = [] wsk = SessionKeys() for i in items: temp = SessionKeyQuery(name=i[0], key=i[1]) keys.append(temp) wsk.items = keys wsk.check_initialized() return wsk
def getWishlists(self, request): """Get all wishlists""" # Query all sessions for thier websafe keys items = [] query = Wishlist.query() for wish in query.fetch(): temp = wish.key.parent().get().displayName items.append([temp, wish.key.urlsafe()]) # Create and send message with all keys and names keys = [] wsk = SessionKeys() for i in items: temp = SessionKeyQuery(name=i[0], key=i[1]) keys.append(temp) wsk.items = keys wsk.check_initialized() return wsk