Beremiz_service.py
changeset 1894 f224383cc883
parent 1893 971de876b1af
child 1900 9d1547578f55
equal deleted inserted replaced
1893:971de876b1af 1894:f224383cc883
   574         except Exception, e:
   574         except Exception, e:
   575             print(_("Nevow/Athena import failed :"), e)
   575             print(_("Nevow/Athena import failed :"), e)
   576             webport = None
   576             webport = None
   577         NS.WorkingDir = WorkingDir
   577         NS.WorkingDir = WorkingDir
   578 
   578 
       
   579     if wampconf is None:
       
   580         _wampconf = os.path.join(WorkingDir, "wampconf.json")
       
   581         if os.path.exists(_wampconf) :
       
   582             wampconf = _wampconf
       
   583 
   579     if wampconf is not None:
   584     if wampconf is not None:
   580         try:
   585         try:
   581             import runtime.WampClient as WC  # pylint: disable=ungrouped-imports
   586             import runtime.WampClient as WC  # pylint: disable=ungrouped-imports
   582         except Exception, e:
   587         except Exception, e:
   583             print(_("WAMP import failed :"), e)
   588             print(_("WAMP import failed :"), e)
   598         except Exception, e:
   603         except Exception, e:
   599             print(_("Nevow Web service failed. "), e)
   604             print(_("Nevow Web service failed. "), e)
   600 
   605 
   601     if wampconf is not None:
   606     if wampconf is not None:
   602         try:
   607         try:
   603             wampconf_project = os.path.join(WorkingDir, "wampconf.json")
   608             _wampconf = WC.LoadWampClientConf(wampconf) # if project WAMP config is added
   604             _wampconf = WC.LoadWampClientConf(wampconf_project) # if project WAMP config is added
   609             if _wampconf :
   605 
   610                 if _wampconf["url"]: #TODO : test more ?
   606             if not _wampconf:
   611                     WC.RegisterWampClient(wampconf, wampsecret)
   607                 # loaded wamp config file path forced parameter -c
   612                     pyruntimevars["wampsession"] = WC.GetSession
   608                 _wampconf = WC.LoadWampClientConf(wampconf)
   613                     WC.SetServer(pyroserver)
       
   614                 else:
       
   615                     print(_("WAMP config is incomplete."))
   609             else:
   616             else:
   610                 wampconf = wampconf_project
   617                 print(_("WAMP config is missing."))
   611 
       
   612             if _wampconf and _wampconf["url"]:
       
   613                 WC.RegisterWampClient(wampconf, wampsecret)
       
   614                 pyruntimevars["wampsession"] = WC.GetSession
       
   615                 WC.SetServer(pyroserver)
       
   616             else:
       
   617                 print(_("WAMP config is not defined."))
       
   618         except Exception, e:
   618         except Exception, e:
   619             print(_("WAMP client startup failed. "), e)
   619             print(_("WAMP client startup failed. "), e)
   620 
   620 
   621 
   621 
   622 if havetwisted or havewx:
   622 if havetwisted or havewx: