X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=manifold%2Fmanifoldapi.py;h=f23ba20ce3efef25b60042df573b31f2221afdb4;hb=5f03119b3bc1f16e68dd805c4b5773ba1ee7148e;hp=c00882ae38a067c668587317e2e8f6c1c606fba8;hpb=9b5bc9a851083b209d3296a7cae0fb67d05763b6;p=myslice.git diff --git a/manifold/manifoldapi.py b/manifold/manifoldapi.py index c00882ae..f23ba20c 100644 --- a/manifold/manifoldapi.py +++ b/manifold/manifoldapi.py @@ -20,13 +20,13 @@ class ManifoldAPI: def __init__(self, auth=None, cainfo=None): - config = Config() self.auth = auth self.cainfo = cainfo self.errors = [] self.trace = [] self.calls = {} self.multicall = False + config = Config() self.url = config.manifold_url() self.server = xmlrpclib.Server(self.url, verbose=False, allow_none=True) @@ -55,7 +55,11 @@ class ManifoldAPI: try: if debug: print "====> ManifoldAPI.%s"%methodName,"auth",self.auth,"args",args,"kwds",kwds - result=getattr(self.server, methodName)(self.auth, *args, **kwds) + annotations = { + 'authentication': self.auth + } + args += (annotations,) + result=getattr(self.server, methodName)(*args, **kwds) if debug: print '<==== backend call %s(*%s,**%s) returned'%(methodName,args,kwds), print '.ctd. Authmethod=',self.auth['AuthMethod'], self.url,'->', @@ -87,6 +91,10 @@ def _execute_query(request, query, manifold_api_session_auth): result = manifold_api.forward(query.to_dict()) if result['code'] == 2: raise Exception, 'Error running query: %r' % result + + if result['code'] == 1: + print "WARNING" + print result['description'] # XXX Handle errors #Error running query: {'origin': [0, 'XMLRPCAPI'], 'code': 2, 'description': 'No such session: No row was found for one()', 'traceback': 'Traceback (most recent call last):\n File "/usr/local/lib/python2.7/dist-packages/manifold/core/xmlrpc_api.py", line 68, in xmlrpc_forward\n user = Auth(auth).check()\n File "/usr/local/lib/python2.7/dist-packages/manifold/auth/__init__.py", line 245, in check\n return self.auth_method.check()\n File "/usr/local/lib/python2.7/dist-packages/manifold/auth/__init__.py", line 95, in check\n raise AuthenticationFailure, "No such session: %s" % e\nAuthenticationFailure: No such session: No row was found for one()\n', 'type': 2, 'ts': None, 'value': None}