X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=manifold%2Fmanifoldapi.py;h=2548287fd69d326f8801b6a2067d8e63b8ce96f7;hb=9e6b289bad3042093d0414ed90a336aaa5bfa09a;hp=c726c656f9455472d67a596327a7a8bee4848b81;hpb=5f74cb3f960c342b56f91d772061900ac48528ea;p=myslice.git diff --git a/manifold/manifoldapi.py b/manifold/manifoldapi.py index c726c656..2548287f 100644 --- a/manifold/manifoldapi.py +++ b/manifold/manifoldapi.py @@ -41,7 +41,12 @@ class ManifoldAPI: ### attempt to cope with old APIs and new APIs if isinstance (result, dict) and 'code' in result: # this sounds like a result from a new API, leave it untouched - return result # jordan + # XXX jordan : we need to wrap it into a ResultValue structure + # XXX this is not good until we merge both repos + if result['code'] != 2: + return ManifoldResult(code=result['code'], value=result['value']) + else: + return ManifoldResult(code=result['code'], output=result['description']) else: if debug: print '<=== backend call', methodName, args, kwds @@ -77,19 +82,3 @@ class ManifoldAPI: print ret print "="*80 return ret - -#old# (action,subject)= (query.action,query.subject) -#old# # use e.g. self.Get rather than self.server.Get so we use the __getattr__ code -#old# if action=='get': -#old## this makes the backend to squeak and one can't login anymore... -#old## return self.Get(subject, query.filters, query.timestamp, query.fields) -#old# return self.Get(subject, query.filters, {}, query.fields) -#old# elif action=='update': -#old# answer=self.Update(subject, query.filters, query.params, query.fields) -#old# if not isinstance (answer, ManifoldResult): print "UNEXECPECTED answer", answer -#old# return answer -#old# else: -#old# warning="WARNING: ManifoldAPI.send_manifold_query: %s not implemented for now"%action -#old# print warning -#old# print 3 -#old# return ManifoldResult(code=ManifoldCode.NOT_IMPLEMENTED, output=warning)