equal
deleted
inserted
replaced
175 super(ReconnectingWampWebSocketClientFactory, self).clientConnectionFailed(connector, reason) |
175 super(ReconnectingWampWebSocketClientFactory, self).clientConnectionFailed(connector, reason) |
176 else: |
176 else: |
177 del connector |
177 del connector |
178 |
178 |
179 |
179 |
180 def LoadWampClientConf(items=None): |
180 def GetConfiguration(items=None): |
181 try: |
181 try: |
182 WSClientConf = json.load(open(_WampConf)) |
182 WSClientConf = json.load(open(_WampConf)) |
183 if items and isinstance(items, list): |
183 if items and isinstance(items, list): |
184 WSClientConfItems = {} |
184 WSClientConfItems = {} |
185 for item in items: |
185 for item in items: |
194 return None |
194 return None |
195 except Exception, e: |
195 except Exception, e: |
196 print(_("WAMP load error: "), e) |
196 print(_("WAMP load error: "), e) |
197 return None |
197 return None |
198 |
198 |
199 def SaveWampClientConf(items): |
199 def SetConfiguration(items): |
200 try: |
200 try: |
201 WSClientConf = LoadWampClientConf() |
201 WSClientConf = json.load(open(_WampConf)) |
202 saveChanges = False |
202 saveChanges = False |
203 if items: |
203 if items: |
204 for itemKey in items.keys(): |
204 for itemKey in items.keys(): |
205 wampconf_value = WSClientConf.get(itemKey, None) |
205 wampconf_value = WSClientConf.get(itemKey, None) |
206 if (wampconf_value is not None) and (items[itemKey] is not None) and (wampconf_value != items[itemKey]): |
206 if (wampconf_value is not None) and (items[itemKey] is not None) and (wampconf_value != items[itemKey]): |
243 |
243 |
244 def RegisterWampClient(wampconf=None, secretfname=None): |
244 def RegisterWampClient(wampconf=None, secretfname=None): |
245 global _WampConf |
245 global _WampConf |
246 if wampconf: |
246 if wampconf: |
247 _WampConf = wampconf |
247 _WampConf = wampconf |
248 WSClientConf = LoadWampClientConf() |
248 WSClientConf = GetConfiguration() |
249 else: |
249 else: |
250 WSClientConf = LoadWampClientConf() |
250 WSClientConf = GetConfiguration() |
251 |
251 |
252 if not WSClientConf: |
252 if not WSClientConf: |
253 print(_("WAMP client connection not established!")) |
253 print(_("WAMP client connection not established!")) |
254 return False |
254 return False |
255 |
255 |