def popular(request): """Most popular list of bookmarks capped at MAX""" rdict = request.matchdict params = request.params # check if we have a page count submitted tags = rdict.get('tags', None) page = int(params.get('page', '0')) recent_list = BmarkMgr.find(limit=RESULTS_MAX, order_by=Bmark.stored.desc(), tags=tags, page=page) return { 'bmarks': recent_list, 'max_count': RESULTS_MAX, 'count': len(recent_list), 'page': page, 'allow_edit': access.edit_enabled(request.registry.settings), } rdict = request.matchdict # check if we have a page count submitted page = int(rdict.get('page', '0')) popular_list = BmarkMgr.popular(limit=RESULTS_MAX, with_tags=True, page=page) return { 'bmarks': popular_list, 'max_count': RESULTS_MAX, 'count': len(popular_list), 'page': page, 'allow_edit': access.edit_enabled(request.registry.settings), }