def get_feed_and_cursor(cursor, limit=10, timestamp=None): if not limit: limit = 10 limit = int(limit) logging.info('Retrieving %d posts from db' % limit) posts = ChoosiePost.all() if cursor: posts.with_cursor(cursor) if timestamp: created_after = Utils.parse_iso_format_datetime(timestamp) posts.filter('created_at >', created_after) posts.order("-created_at") posts_result = [] for post in posts.run(limit=limit): posts_result.append(post) new_cursor = posts.cursor() CacheController.set_multi_models(posts_result) return (posts_result, new_cursor)
def get_feed_and_cursor(cursor, limit = 10, timestamp = None): if not limit: limit = 10 limit = int(limit) logging.info('Retrieving %d posts from db' % limit) posts = ChoosiePost.all() if cursor: posts.with_cursor(cursor) if timestamp: created_after = Utils.parse_iso_format_datetime(timestamp) posts.filter('created_at >', created_after) posts.order("-created_at") posts_result = [] for post in posts.run(limit=limit): posts_result.append(post) new_cursor = posts.cursor() CacheController.set_multi_models(posts_result) return (posts_result, new_cursor)