182 |
|
|
183 |
|
|
184 |
def request(self, service, params={}): |
def request(self, service, params={}): |
185 |
|
# TODO: add support for more than one baseproxy |
186 |
self._baseproxy = _ProxyObject(self, service) |
self._baseproxy = _ProxyObject(self, service) |
187 |
return self._baseproxy |
return self._baseproxy |
188 |
|
|
234 |
|
|
235 |
def runMethod(self, method, *args, **params): |
def runMethod(self, method, *args, **params): |
236 |
# print "Calling method: %s with attr %s " % method,string.join(args,",") |
# print "Calling method: %s with attr %s " % method,string.join(args,",") |
237 |
|
|
238 |
|
# check for special parameters |
239 |
|
i=0 |
240 |
|
while i<len(args): |
241 |
|
# care for special types |
242 |
|
if hasattr(args[i],'_type'): |
243 |
|
if args[i]._type=='base64': |
244 |
|
args[i]=xmlrpc.base64(args[i]._value) |
245 |
|
elif args[i]._type=='binary': |
246 |
|
args[i]=xmlrpc.base64(args[i]._value) |
247 |
|
elif args[i]._type=='boolean': |
248 |
|
args[i]=xmlrpc.boolean(args[i]._value) |
249 |
|
elif args[i]._type=='datetime': |
250 |
|
args[i]=xmlrpc.datetime(args[i]._value) |
251 |
|
else: |
252 |
|
if hasattr(args[i],'_value'): |
253 |
|
args[i]=args[i]._value |
254 |
|
i=i+1 |
255 |
|
|
256 |
|
|
257 |
|
# call the method |
258 |
try: |
try: |
259 |
# send authentication info? |
# send authentication info? |
260 |
if hasattr(self,'_auth_name'): |
if hasattr(self,'_auth_name'): |
269 |
msg= _("Unable to connect to XML-RPC server ") + \ |
msg= _("Unable to connect to XML-RPC server ") + \ |
270 |
_("at '%s' \n(connection refused)\n") % self._url + \ |
_("at '%s' \n(connection refused)\n") % self._url + \ |
271 |
_("please check if the server is running") |
_("please check if the server is running") |
|
#raise GComm.CommunicationsError, msg |
|
272 |
else: |
else: |
273 |
msg="Error: %s" % (sys.exc_value,) |
msg="Error: %s" % (sys.exc_value,) |
274 |
|
|
292 |
# catch unknown service faults created by pw_xmlrpc/ServerAdapter |
# catch unknown service faults created by pw_xmlrpc/ServerAdapter |
293 |
elif sys.exc_value.faultString[:26]== \ |
elif sys.exc_value.faultString[:26]== \ |
294 |
'exceptions.AttributeError:': |
'exceptions.AttributeError:': |
295 |
msg=_("%s")\ |
msg="%s"\ |
296 |
% sys.exc_value.faultString[26:] |
% sys.exc_value.faultString[26:] |
297 |
raise GComm.InvalidService,msg,sys.exc_traceback |
raise GComm.InvalidService,msg,sys.exc_traceback |
298 |
|
|