connectors/PYRO/PSK_Adapter.py
changeset 2543 2befed4d6ca8
parent 2537 eb4a4cc41914
child 2544 640d639d9bd8
equal deleted inserted replaced
2542:a3ec35ee94e7 2543:2befed4d6ca8
    68     if protocol in ('PYROPSK', 'PYROLOCPSK'):
    68     if protocol in ('PYROPSK', 'PYROLOCPSK'):
    69         return PYROPSKAdapter()
    69         return PYROPSKAdapter()
    70     return _getProtocolAdapter(protocol)
    70     return _getProtocolAdapter(protocol)
    71 
    71 
    72 
    72 
    73 Pyro.protocol.getProtocolAdapter = getProtocolAdapter
       
    74 
       
    75 
       
    76 _processStringURI = Pyro.core.processStringURI
    73 _processStringURI = Pyro.core.processStringURI
    77 
    74 
    78 
    75 
    79 def processStringURI(URI):
    76 def processStringURI(URI):
    80     x = re.match(r'(?P<protocol>PYROLOCPSK)://(?P<hostname>[^\s:]+):?(?P<port>\d+)?/(?P<name>\S*)', URI)
    77     x = re.match(r'(?P<protocol>PYROLOCPSK)://(?P<hostname>[^\s:]+):?(?P<port>\d+)?/(?P<name>\S*)', URI)
    89         name = x.group('name')
    86         name = x.group('name')
    90         return PyroURI(hostname, name, port, protocol)
    87         return PyroURI(hostname, name, port, protocol)
    91     return _processStringURI(URI)
    88     return _processStringURI(URI)
    92 
    89 
    93 
    90 
    94 Pyro.core.processStringURI = processStringURI
    91 def setupPSKAdapter():
       
    92     """
       
    93     Add PyroAdapter to the list of available in
       
    94     Pyro adapters and handle new supported protocols
       
    95 
       
    96     This function should be called after
       
    97     reimport of Pyro module to enable PYROS:// again.
       
    98     """
       
    99     Pyro.protocol.getProtocolAdapter = getProtocolAdapter
       
   100     Pyro.core.processStringURI = processStringURI