various fixes
[myslice.git] / manifold / manifoldapi.py
index c726c65..2548287 100644 (file)
@@ -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)