+ def __repr__ (self): return "ManifoldAPI[%s]"%self.url
+
+ # a one-liner to give a hint of what the return value looks like
+ def _print_result (self, result):
+ if not result: print "[no/empty result]"
+ elif isinstance (result,str): print "result is '%s'"%result
+ elif isinstance (result,list): print "result is a %d-elts list"%len(result)
+ elif isinstance (result,dict):
+ print "result is a dict with %d keys : %s"%(len(result),result.keys())
+ for (k,v) in result.iteritems():
+ if v is None: continue
+ print '+++',k,':',mytruncate (v,60)
+ else: print "[dont know how to display result] %s"%result
+
+ # xxx temporary code for scaffolding a ManifolResult on top of an API that does not expose error info
+ # as of march 2013 we work with an API that essentially either returns the value, or raises
+ # an xmlrpclib.Fault exception with always the same 8002 code
+ # since most of the time we're getting this kind of issues for expired sessions
+ # (looks like sessions are rather short-lived), for now the choice is to map these errors on
+ # a SESSION_EXPIRED code