git://git.onelab.eu
/
myslice.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
manifoldapi now expects the URL as an argument to its constructor
[myslice.git]
/
manifoldapi
/
manifoldproxy.py
diff --git
a/manifoldapi/manifoldproxy.py
b/manifoldapi/manifoldproxy.py
index
a5bc20d
..
5268f41
100644
(file)
--- a/
manifoldapi/manifoldproxy.py
+++ b/
manifoldapi/manifoldproxy.py
@@
-10,9
+10,8
@@
from manifold.core.query import Query
from manifold.core.result_value import ResultValue
from manifoldapi import ManifoldAPI
from manifoldresult import ManifoldException
from manifold.core.result_value import ResultValue
from manifoldapi import ManifoldAPI
from manifoldresult import ManifoldException
-from manifold.util.log import Log
-from unfold.sessioncache import SessionCache
+
#
from unfold.sessioncache import SessionCache
from myslice.settings import config, logger
from myslice.settings import config, logger
@@
-32,7
+31,12
@@
debug_empty=False
# myslice/urls.py
# as well as
# static/js/manifold.js
# myslice/urls.py
# as well as
# static/js/manifold.js
-def proxy (request,format):
+def proxy(request, format):
+ from myslice.settings import config
+ url = config.manifold_url()
+ return _proxy(url, request, format)
+
+def _proxy(url, request, format):
"""the view associated with /manifold/proxy/ with the query passed using POST"""
# expecting a POST
"""the view associated with /manifold/proxy/ with the query passed using POST"""
# expecting a POST
@@
-61,15
+65,18
@@
def proxy (request,format):
admin_user, admin_password = config.manifold_admin_user_password()
manifold_api_session_auth = {'AuthMethod': 'password', 'Username': admin_user, 'AuthString': admin_password}
else:
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 = SessionCache().get_auth(request)
- if not manifold_api_session_auth:
+ if 'manifold' in request.session:
+ manifold_api_session_auth = request.session['manifold']['auth']
+ else:
+ #manifold_api_session_auth = SessionCache().get_auth(request)
+ #if not manifold_api_session_auth:
return HttpResponse (json.dumps({'code':0,'value':[]}), content_type="application/json")
if debug_empty and manifold_query.action.lower()=='get':
return HttpResponse (json.dumps({'code':0,'value':[]}), content_type="application/json")
# actually forward
return HttpResponse (json.dumps({'code':0,'value':[]}), content_type="application/json")
if debug_empty and manifold_query.action.lower()=='get':
return HttpResponse (json.dumps({'code':0,'value':[]}), content_type="application/json")
# actually forward
- manifold_api= ManifoldAPI(auth=manifold_api_session_auth)
+ manifold_api= ManifoldAPI(
url,
auth=manifold_api_session_auth)
# for the benefit of the python code, manifoldAPI raises an exception if something is wrong
# however in this case we want to propagate the complete manifold result to the js world
# for the benefit of the python code, manifoldAPI raises an exception if something is wrong
# however in this case we want to propagate the complete manifold result to the js world