X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=manifold%2Fmanifoldapi.py;fp=manifold%2Fmanifoldapi.py;h=1ffcacee0725669778edd628436fb496744cbd04;hb=e6184193b74ac6d5c52289546dae9121bdd99008;hp=35fd3d74e7c5bbd901fd51174dd2d937e2bfe114;hpb=3167207804460a2c42e1e5a8346c597f9832d295;p=unfold.git diff --git a/manifold/manifoldapi.py b/manifold/manifoldapi.py index 35fd3d74..1ffcacee 100644 --- a/manifold/manifoldapi.py +++ b/manifold/manifoldapi.py @@ -52,15 +52,28 @@ 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 - result=getattr(self.server, methodName)(self.auth, *args, **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) 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) @@ -70,11 +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 - 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