X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=manifold%2Fmanifoldapi.py;h=46229f17fc679abbb86acd5031bdafbd4ee0d144;hb=1295aaac83bf744acabf41920122837ea2b421d8;hp=f23ba20ce3efef25b60042df573b31f2221afdb4;hpb=5f03119b3bc1f16e68dd805c4b5773ba1ee7148e;p=myslice.git diff --git a/manifold/manifoldapi.py b/manifold/manifoldapi.py index f23ba20c..46229f17 100644 --- a/manifold/manifoldapi.py +++ b/manifold/manifoldapi.py @@ -52,19 +52,30 @@ 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,"auth",self.auth,"args",args,"kwds",kwds + print "====> ManifoldAPI.%s"%repr(),"url",self.url + print "=> auth",self.auth + print "=> args",args,"kwds",kwds annotations = { 'authentication': self.auth } args += (annotations,) result=getattr(self.server, methodName)(*args, **kwds) + print "%s%r" %(methodName, args) + 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) @@ -74,11 +85,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 - 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