def _json(action): return jsonify(dispatch_action(request.values, action))
result = {} try: blob_infos = get_blob_info_list(request) if not blob_infos: raise Exception("can not get blob info") photos = [apis.Photo.create_photo_with_url(**info) for info in blob_infos] result["status"] = "ok" result["photos"] = photos except Exception, e: from settings import logging logging.exception("error in upload_handler:") result["error"] = unicode(e) result["status"] = "error" return jsonify(result) ######################################## ## Start Application ######################################## if RUNTIME_ENV == "bae": from bae.core.wsgi import WSGIApplication application = WSGIApplication(app) elif RUNTIME_ENV == "sae": import sae application = sae.create_wsgi_app(app) elif RUNTIME_ENV == "local": application = app
blob_infos = get_blob_info_list(request) if not blob_infos: raise Exception("can not get blob info") photos = [ apis.Photo.create_photo_with_url(**info) for info in blob_infos ] result["status"] = "ok" result["photos"] = photos except Exception, e: from settings import logging logging.exception("error in upload_handler:") result["error"] = unicode(e) result["status"] = "error" return jsonify(result) from weixin.WeiXin import echo ######################################## ## Start Application ######################################## if RUNTIME_ENV == "bae": from bae.core.wsgi import WSGIApplication application = WSGIApplication(app) elif RUNTIME_ENV == "sae": import sae application = sae.create_wsgi_app(app)