replace forbidden chars in db keys

This commit is contained in:
Davide Alberani 2017-04-28 22:57:48 +02:00
parent d69cbcaa63
commit 9f942fd4eb
2 changed files with 8 additions and 3 deletions

View file

@ -588,6 +588,8 @@ class CollectionHandler(BaseHandler):
args = '?uuid=%s' % self.get_argument('uuid') args = '?uuid=%s' % self.get_argument('uuid')
except: except:
args = '' 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) return 'ws://127.0.0.1:%s/ws/%s%s' % (self.listen_port + 1, path, args)
@gen.coroutine @gen.coroutine
@ -600,7 +602,10 @@ class CollectionHandler(BaseHandler):
:type message: str :type message: str
""" """
try: 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.write_message(message)
ws.close() ws.close()
except Exception as e: except Exception as e:

View file

@ -3,7 +3,7 @@
Miscellaneous utilities. Miscellaneous utilities.
Copyright 2015-2016 Davide Alberani <da@erlug.linux.it> Copyright 2015-2017 Davide Alberani <da@erlug.linux.it>
RaspiBO <info@raspibo.org> RaspiBO <info@raspibo.org>
Licensed under the Apache License, Version 2.0 (the "License"); 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: if header in remap:
headers[idx] = remap[header] headers[idx] = remap[header]
else: else:
headers[idx] = header.lower().replace(' ', '_') headers[idx] = header.lower().replace(' ', '_').replace('.', '_')
try: try:
for row in reader: for row in reader:
try: try: