- manifold_api_session_auth = request.session['manifold']['auth']
- ### patch : return the latest one..
- if work_offline:
- # if that won't work then we'll try to update anyways
- try:
- with (file(offline_filename,"r")) as f:
- json_answer=f.read()
- print "By-passing : using contents from %s"%offline_filename
- return HttpResponse (json_answer, mimetype="application/json")
- except:
- import traceback
- traceback.print_exc()
- print "PROCEEDING"
- pass
+
+ # We allow some requests to use the ADMIN user account
+ if (manifold_query.get_from() == 'local:user' and manifold_query.get_action() == 'create') \
+ or (manifold_query.get_from() == 'local:platform' and manifold_query.get_action() == 'get'):
+ admin_user, admin_password = Config().manifold_admin_user_password()
+ manifold_api_session_auth = {'AuthMethod': 'password', 'Username': admin_user, 'AuthString': admin_password}
+ else:
+ manifold_api_session_auth = request.session['manifold']['auth']
+
+ if debug_empty and manifold_query.action.lower()=='get':
+ json_answer=json.dumps({'code':0,'value':[]})
+ print "By-passing : debug_empty & 'get' request : returning a fake empty list"
+ return HttpResponse (json_answer, mimetype="application/json")