def test(): """given user id and return all items""" uid = request.values.get('uid') if not uid: return {'error': 'please visit with uid=1'} t = get_user_fetcher_celery_task() t(uid) data = list(get_mongo('item').find()) def chg(d): for k, v in d.iteritems(): if isinstance(v, datetime): d[k] = str(v) elif isinstance(v, Binary): d[k] = ItemDescBase.deserialize(v).render_title() map(chg, data) return {'data': data}
def refresh(): """refresh user-specified fetchers""" t = get_user_fetcher_celery_task() t(get_current_user_id()) return {'success': 1}