X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fserver%2Fmodpythonapi%2FBaseClient.py;h=56d728603aab25c10c9a6f2142afe6c6354c891c;hb=ca37ec53ab3e64ad0c87e69e05697fd7f0302539;hp=5dd72a12ac81d1b21323665800b6b47ceff7256d;hpb=d88ac8f7ae64fd715146773b8f863405ac1466ad;p=sfa.git diff --git a/sfa/server/modpythonapi/BaseClient.py b/sfa/server/modpythonapi/BaseClient.py index 5dd72a12..56d72860 100755 --- a/sfa/server/modpythonapi/BaseClient.py +++ b/sfa/server/modpythonapi/BaseClient.py @@ -2,12 +2,6 @@ import xmlrpclib from ApiExceptionCodes import * -VerboseExceptions = False - -def EnableVerboseExceptions(x=True): - global VerboseExceptions - VerboseExceptions = x - class ExceptionUnmarshaller(xmlrpclib.Unmarshaller): def close(self): try: @@ -19,7 +13,7 @@ class ExceptionUnmarshaller(xmlrpclib.Unmarshaller): if "\nFAULT_TRACEBACK:" in e.faultString: parts = e.faultString.split("\nFAULT_TRACEBACK:") e.faultString = parts[0] - if VerboseExceptions: + if BaseClient.VerboseExceptions: print "\n|Server Traceback:", "\n|".join(parts[1].split("\n")) raise e @@ -38,9 +32,17 @@ class ExceptionReportingTransport(xmlrpclib.Transport): return parser, unmarshaller class BaseClient(): + + VerboseExceptions = False + def __init__(self, url): self.url = url self.server = xmlrpclib.ServerProxy(self.url, ExceptionReportingTransport()) def noop(self, value): return self.server.noop(value) + + @staticmethod + def EnableVerboseExceptions(x=True): + BaseClient.VerboseExceptions = x +