sorted filenames
This commit is contained in:
parent
98a82b7d6a
commit
b90c85f56e
1 changed files with 7 additions and 7 deletions
14
webserver.py
14
webserver.py
|
@ -36,7 +36,7 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler):
|
||||||
"""
|
"""
|
||||||
Websocket from the workers
|
Websocket from the workers
|
||||||
"""
|
"""
|
||||||
CORS_ORIGINS = ['localhost']
|
# CORS_ORIGINS = ['localhost']
|
||||||
connections = set()
|
connections = set()
|
||||||
|
|
||||||
def initialize(self, config):
|
def initialize(self, config):
|
||||||
|
@ -45,11 +45,11 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler):
|
||||||
self.hasWritten = False
|
self.hasWritten = False
|
||||||
self.dimensions = [None, None]
|
self.dimensions = [None, None]
|
||||||
|
|
||||||
def check_origin(self, origin):
|
# def check_origin(self, origin):
|
||||||
parsed_origin = urlparse(origin)
|
# parsed_origin = urlparse(origin)
|
||||||
# parsed_origin.netloc.lower() gives localhost:3333
|
# # parsed_origin.netloc.lower() gives localhost:3333
|
||||||
valid = any([parsed_origin.hostname.endswith(origin) for origin in self.CORS_ORIGINS])
|
# valid = any([parsed_origin.hostname.endswith(origin) for origin in self.CORS_ORIGINS])
|
||||||
return valid
|
# return valid
|
||||||
|
|
||||||
# the client connected
|
# the client connected
|
||||||
def open(self, p = None):
|
def open(self, p = None):
|
||||||
|
@ -127,7 +127,7 @@ class AnimationHandler(tornado.web.RequestHandler):
|
||||||
self.set_header("Content-Type", "application/json")
|
self.set_header("Content-Type", "application/json")
|
||||||
# filename = self.get_argument("file", None)
|
# filename = self.get_argument("file", None)
|
||||||
if filename == '':
|
if filename == '':
|
||||||
names = [f"/files/{name[:-4]}" for name in os.listdir(self.config.storage) if name not in ['.gitignore']]
|
names = sorted([f"/files/{name[:-4]}" for name in os.listdir(self.config.storage) if name not in ['.gitignore']])
|
||||||
self.write(json.dumps(names))
|
self.write(json.dumps(names))
|
||||||
else:
|
else:
|
||||||
path = os.path.join(self.config.storage,os.path.basename(filename)+".csv")
|
path = os.path.join(self.config.storage,os.path.basename(filename)+".csv")
|
||||||
|
|
Loading…
Reference in a new issue