/[papo]/gnue/common/src/commdrivers/xmlrpc/ClientAdapter.py
ViewVC logotype

Diff of /gnue/common/src/commdrivers/xmlrpc/ClientAdapter.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by charlie, Tue Aug 27 18:15:52 2002 UTC revision 1.4 by styxman, Fri Nov 15 15:32:55 2002 UTC
# Line 182  class ClientAdapter(GCommBase.Client): Line 182  class ClientAdapter(GCommBase.Client):
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    
# Line 233  class ClientAdapter(GCommBase.Client): Line 234  class ClientAdapter(GCommBase.Client):
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'):
# Line 247  class ClientAdapter(GCommBase.Client): Line 269  class ClientAdapter(GCommBase.Client):
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                        
# Line 271  class ClientAdapter(GCommBase.Client): Line 292  class ClientAdapter(GCommBase.Client):
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    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26