--- a/Beremiz_service.py Tue Jan 09 15:08:08 2018 +0100
+++ b/Beremiz_service.py Wed Jan 10 13:21:42 2018 +0100
@@ -576,6 +576,11 @@
NS.WorkingDir = WorkingDir
+ _wampconf = os.path.join(WorkingDir, "wampconf.json") + if os.path.exists(_wampconf) : import runtime.WampClient as WC # pylint: disable=ungrouped-imports
@@ -600,21 +605,16 @@
- wampconf_project = os.path.join(WorkingDir, "wampconf.json")
- _wampconf = WC.LoadWampClientConf(wampconf_project) # if project WAMP config is added
- # loaded wamp config file path forced parameter -c
- _wampconf = WC.LoadWampClientConf(wampconf)
+ _wampconf = WC.LoadWampClientConf(wampconf) # if project WAMP config is added + if _wampconf["url"]: #TODO : test more ? + WC.RegisterWampClient(wampconf, wampsecret) + pyruntimevars["wampsession"] = WC.GetSession + WC.SetServer(pyroserver) + print(_("WAMP config is incomplete.")) - wampconf = wampconf_project
- if _wampconf and _wampconf["url"]:
- WC.RegisterWampClient(wampconf, wampsecret)
- pyruntimevars["wampsession"] = WC.GetSession
- WC.SetServer(pyroserver)
- print(_("WAMP config is not defined."))
+ print(_("WAMP config is missing.")) print(_("WAMP client startup failed. "), e)
--- a/connectors/WAMP/__init__.py Tue Jan 09 15:08:08 2018 +0100
+++ b/connectors/WAMP/__init__.py Wed Jan 10 13:21:42 2018 +0100
@@ -83,7 +83,7 @@
# create a WAMP application session factory
component_config = types.ComponentConfig(
session_factory = wamp.ApplicationSessionFactory(
@@ -93,9 +93,7 @@
transport_factory = WampWebSocketClientFactory(
- serializers=[MsgPackSerializer()],
+ serializers=[MsgPackSerializer()]) # start the client from a Twisted endpoint
conn = connectWS(transport_factory)
@@ -111,7 +109,7 @@
reactor.run(installSignalHandlers=False)
def WampSessionProcMapper(funcname):
- wampfuncname = '.'.join((ID, funcname))
+ wampfuncname = unicode('.'.join((ID, funcname))) def catcher_func(*args, **kwargs):
if _WampSession is not None:
--- a/runtime/WampClient.py Tue Jan 09 15:08:08 2018 +0100
+++ b/runtime/WampClient.py Wed Jan 10 13:21:42 2018 +0100
@@ -70,8 +70,7 @@
class WampSession(wamp.ApplicationSession):
- secret = self.config.extra["secret"]
+ if self.config.extra.has_key("secret"): user = self.config.extra["ID"].encode('utf8')
self.join(u"Automation", [u"wampcra"], user)
@@ -143,7 +142,7 @@
WSClientConf = LoadWampClientConf(wampconf)
- print _("WAMP client connection not established!")
+ print(_("WAMP client connection not established!")) WampSecret = LoadWampSecret(secretfname)
@@ -164,7 +163,7 @@
# start the client from a Twisted endpoint
conn = connectWS(transport_factory)
- print(_("WAMP client connecting to :"), _WSClientConf["url"])
+ print(_("WAMP client connecting to :"), WSClientConf["url"])