diff --git a/eventman_server.py b/eventman_server.py index 1166706..eb77bb7 100755 --- a/eventman_server.py +++ b/eventman_server.py @@ -588,6 +588,8 @@ class CollectionHandler(BaseHandler): args = '?uuid=%s' % self.get_argument('uuid') except: args = '' + if not hasattr(self, 'listen_port'): + return None return 'ws://127.0.0.1:%s/ws/%s%s' % (self.listen_port + 1, path, args) @gen.coroutine @@ -600,7 +602,10 @@ class CollectionHandler(BaseHandler): :type message: str """ try: - ws = yield tornado.websocket.websocket_connect(self.build_ws_url(path)) + url = self.build_ws_url(path) + if not url: + return + ws = yield tornado.websocket.websocket_connect(url) ws.write_message(message) ws.close() except Exception as e: diff --git a/utils.py b/utils.py index 81de037..49f29df 100644 --- a/utils.py +++ b/utils.py @@ -3,7 +3,7 @@ Miscellaneous utilities. -Copyright 2015-2016 Davide Alberani +Copyright 2015-2017 Davide Alberani RaspiBO Licensed under the Apache License, Version 2.0 (the "License"); @@ -59,7 +59,7 @@ def csvParse(csvStr, remap=None, merge=None): if header in remap: headers[idx] = remap[header] else: - headers[idx] = header.lower().replace(' ', '_') + headers[idx] = header.lower().replace(' ', '_').replace('.', '_') try: for row in reader: try: