connectors/__init__.py
branchwxPython4
changeset 3721 6365e33fb11f
parent 3501 fa291393aac7
child 3750 f62625418bff
equal deleted inserted replaced
3720:d0a9c01ee7a5 3721:6365e33fb11f
    25 
    25 
    26 # Package initialisation
    26 # Package initialisation
    27 
    27 
    28 
    28 
    29 from __future__ import absolute_import
    29 from __future__ import absolute_import
       
    30 import os
    30 from os import listdir, path
    31 from os import listdir, path
    31 from connectors.ConnectorBase import ConnectorBase
    32 from connectors.ConnectorBase import ConnectorBase
    32 
    33 
    33 connectors_packages = ["PYRO", "WAMP"]
    34 connectors_packages = ["PYRO", "WAMP"]
    34 
    35 
    58             for scheme in module.Schemes:
    59             for scheme in module.Schemes:
    59                 per_URI_connectors[scheme] = getattr(module, con_name + '_dialog')
    60                 per_URI_connectors[scheme] = getattr(module, con_name + '_dialog')
    60                 schemes += [scheme]
    61                 schemes += [scheme]
    61 
    62 
    62 
    63 
       
    64 LocalHost = os.environ.get("BEREMIZ_LOCAL_HOST", "localhost")
       
    65 
    63 def ConnectorFactory(uri, confnodesroot):
    66 def ConnectorFactory(uri, confnodesroot):
    64     """
    67     """
    65     Return a connector corresponding to the URI
    68     Return a connector corresponding to the URI
    66     or None if cannot connect to URI
    69     or None if cannot connect to URI
    67     """
    70     """
    75         # Local is special case
    78         # Local is special case
    76         # pyro connection to local runtime
    79         # pyro connection to local runtime
    77         # started on demand, listening on random port
    80         # started on demand, listening on random port
    78         scheme = "PYRO"
    81         scheme = "PYRO"
    79         runtime_port = confnodesroot.StartLocalRuntime()
    82         runtime_port = confnodesroot.StartLocalRuntime()
    80         uri = "PYROLOC://127.0.0.1:" + str(runtime_port)
    83         uri = "PYROLOC://"+LocalHost+":" + str(runtime_port)
    81 
    84 
    82     # commented code to enable for MDNS:// support
    85     # commented code to enable for MDNS:// support
    83     # elif _scheme == "MDNS":
    86     # elif _scheme == "MDNS":
    84     #     try:
    87     #     try:
    85     #         from zeroconf import Zeroconf
    88     #         from zeroconf import Zeroconf