/[papo]/gnue/common/src/commdrivers/pw_xmlrpc/ServerAdapter.py
ViewVC logotype

Diff of /gnue/common/src/commdrivers/pw_xmlrpc/ServerAdapter.py

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

revision 1.1 by charlie, Fri Jun 28 19:43:51 2002 UTC revision 1.1.4.1 by anthonyl, Tue Mar 4 22:09:33 2003 UTC
# Line 16  Line 16 
16  # write to the Free Software Foundation, Inc., 59 Temple Place  # write to the Free Software Foundation, Inc., 59 Temple Place
17  # - Suite 330, Boston, MA 02111-1307, USA.  # - Suite 330, Boston, MA 02111-1307, USA.
18  #  #
19  # Copyright 2001 Free Software Foundation  # Copyright 2001-2003 Free Software Foundation
20  #  #
21  # FILE:  # FILE:
22  # xmlrpc/ServerAdapter.py  # xmlrpc/ServerAdapter.py
# Line 64  try: Line 64  try:
64      from xmlrpclib import xmlrpclib      from xmlrpclib import xmlrpclib
65    
66  except ImportError:  except ImportError:
67    raise GComm.AdapterInitializationError, \    tmsg = _("\nUnable to load xmlrpclib.  To use the XML-RPC interface, \n") \
         _("\nUnable to load xmlrpclib.  To use the XML-RPC interface, \n") \  
68        + _("please install xmlrpc from:\n") \        + _("please install xmlrpc from:\n") \
69        + "    http://www.pythonware.com/products/xmlrpc/"        + "    http://www.pythonware.com/products/xmlrpc/"
70      raise GComm.AdapterInitializationError, tmsg
71    
72    
73  # Mapping from GRPC's datatype to XML-RPC datatypes  # Mapping from GRPC's datatype to XML-RPC datatypes
# Line 118  class ServerAdapter(DirectoryServer.Dire Line 117  class ServerAdapter(DirectoryServer.Dire
117      try:      try:
118        self._port = params['port']        self._port = params['port']
119      except KeyError:      except KeyError:
120        raise GComm.AdapterConfigurationError, _('Required parameter "port" not supplied')        tmsg = _('Required parameter "port" not supplied')
121          raise GComm.AdapterConfigurationError, tmsg
122    
123      if hasattr(params,'loglevel'):      if hasattr(params,'loglevel'):
124        self._loglevel = params['loglevel']        self._loglevel = params['loglevel']
# Line 183  class ServerAdapter(DirectoryServer.Dire Line 183  class ServerAdapter(DirectoryServer.Dire
183          objhandle=method[1:i]          objhandle=method[1:i]
184          method=method[i+2:]          method=method[i+2:]
185        except ValueError:        except ValueError:
186          raise AttributeError, \          tmsg = _("Wrong format of object handle ")+\
               _("Wrong format of object handle ")+\  
187                _("in method call %s") % method                _("in method call %s") % method
188            raise AttributeError, tmsg
189        # TODO check in service dir, if obj is supported or not        # TODO check in service dir, if obj is supported or not
190        o=ObjectLibrarian.retrieveObject(objhandle)        o=ObjectLibrarian.retrieveObject(objhandle)
191        try:        try:
# Line 230  class ServerAdapter(DirectoryServer.Dire Line 230  class ServerAdapter(DirectoryServer.Dire
230          signature=direntry['signature']          signature=direntry['signature']
231    
232          if (server_method==None) and (server_attribute==None):          if (server_method==None) and (server_attribute==None):
233            raise AttributeError, \            tmsg = _("Server XML-RPC method %s  is not ")% method +\
               _("Server XML-RPC method %s  is not ")% method +\  
234                _("bound to real method")                _("bound to real method")
235              raise AttributeError, tmsg
236        except KeyError:        except KeyError:
237          raise AttributeError, \          tmsg = _("Server does not have XML-RPC ") +\
               _("Server does not have XML-RPC ") +\  
238                _("procedure %s") % method                      _("procedure %s") % method      
239            raise AttributeError, tmsg
240      try:      try:
241        #        #
242        pass        pass
243          # TODO:  Compare submitted attributs with signature          # TODO:  Compare submitted attributs with signature
244      except KeyError:      except KeyError:
245        raise AttributeError, \        tmsg = _("Server XML-RPC ") +\
             _("Server XML-RPC ") +\  
246              _("procedure %s accepts just %s as attributs") % (method,attr)              _("procedure %s accepts just %s as attributs") % (method,attr)
247          raise AttributeError, tmsg
248            
249    
250      # replace object handles in param with the real object      # replace object handles in param with the real object
# Line 291  class ServerAdapter(DirectoryServer.Dire Line 291  class ServerAdapter(DirectoryServer.Dire
291          # getAttribut method          # getAttribut method
292          result=server_attribute          result=server_attribute
293        else:        else:
294          raise AttributeError, \          tmsg = _("Internal Server XML-RPC error: method type") +\
             _("Internal Server XML-RPC error: method type") +\  
295              _("(get/set attribute) couldn't be detected (method %s)") \              _("(get/set attribute) couldn't be detected (method %s)") \
296              % method                    % method      
297            raise AttributeError, tmsg
298            
299    
300      # replace real object in param with an object handle      # replace real object in param with an object handle
# Line 449  class _ObjectByReferenceHandler: Line 449  class _ObjectByReferenceHandler:
449          del args['obj_handle']          del args['obj_handle']
450    
451        except KeyError:        except KeyError:
452          raise StandardError, _('Object handle not returned')   # TODO          tmsg = _('Object handle not returned')
453            raise StandardError, tmsg   # TODO
454    
455      try:      try:
456        return ObjectLibrarian. \        return ObjectLibrarian. \
# Line 457  class _ObjectByReferenceHandler: Line 458  class _ObjectByReferenceHandler:
458      except KeyError:      except KeyError:
459    
460        # Attempt to use an invalid objecthandle        # Attempt to use an invalid objecthandle
461        raise StandardError, _('Invalid object handle') # TODO        tmsg = _('Invalid object handle')
462          raise StandardError, tmsg # TODO
463    
464    
465    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.4.1

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