X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=manifold%2Fmanifoldapi.py;fp=manifold%2Fmanifoldapi.py;h=1ffcacee0725669778edd628436fb496744cbd04;hb=89d8e2ea86f00e9c5a6572d0edd2aa231f30c091;hp=1ba0db4275bb8806bf785959c3f468844437cafa;hpb=1710230d6c76a139ae890d16767458cb8543ea35;p=myslice.git diff --git a/manifold/manifoldapi.py b/manifold/manifoldapi.py index 1ba0db42..1ffcacee 100644 --- a/manifold/manifoldapi.py +++ b/manifold/manifoldapi.py @@ -52,9 +52,17 @@ class ManifoldAPI: # a SESSION_EXPIRED code def __getattr__(self, methodName): def func(*args, **kwds): + # how to display a call + def repr (): + # most of the time, we run 'forward' + if methodName=='forward': + try: action="forward(%s)"%args[0]['action'] + except: action="forward(??)" + else: action=methodName + return action try: if debug: - print "====> ManifoldAPI.%s"%methodName,"url",self.url + print "====> ManifoldAPI.%s"%repr(),"url",self.url print "=> auth",self.auth print "=> args",args,"kwds",kwds annotations = { @@ -63,10 +71,9 @@ class ManifoldAPI: 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,'->', + print '<= result=', self._print_result(result) - print '===== ManifoldAPI call done' + print '<==== backend call %s returned'%(repr()), return ResultValue(**result) @@ -76,12 +83,12 @@ class ManifoldAPI: raise ManifoldException ( ManifoldResult (code=ManifoldCode.SERVER_UNREACHABLE, output="%s answered %s"%(self.url,error))) # otherwise - print "====> ERROR On ManifoldAPI.%s"%methodName,"auth",self.auth,"args",args,"kwds",kwds - import traceback - traceback.print_exc() - if debug: print "KO (unexpected exception)",error - print '===== ManifoldAPI call exiting' - raise ManifoldException ( ManifoldResult (code=ManifoldCode.UNKNOWN_ERROR, output="%s"%error) ) + if debug: + print "===== xmlrpc catch-all exception:",error + import traceback + traceback.print_exc(limit=3) + print "<==== ERROR On ManifoldAPI.%s"%repr() + raise ManifoldException ( ManifoldResult (code=ManifoldCode.SERVER_UNREACHABLE, output="%s"%error) ) return func