From 92d262e82ab0dfab2e70a60204b569f39c3c4be8 Mon Sep 17 00:00:00 2001 From: Miguel Barao Date: Tue, 15 Nov 2016 17:32:48 +0000 Subject: [PATCH] - abort with error message if directory "logs" does not exist in the current directory. --- BUGS.md | 14 ++++++-------- config/server.conf | 2 +- serve.py | 10 +++++++--- static/bootstrap-3.3.7/.DS_Store | Bin 6148 -> 0 bytes static/bootstrap-3.3.7/css/.DS_Store | Bin 6148 -> 0 bytes 5 files changed, 14 insertions(+), 12 deletions(-) delete mode 100644 static/bootstrap-3.3.7/.DS_Store delete mode 100644 static/bootstrap-3.3.7/css/.DS_Store diff --git a/BUGS.md b/BUGS.md index 43f8d3d..6bfd5d4 100644 --- a/BUGS.md +++ b/BUGS.md @@ -1,30 +1,28 @@ # BUGS -- se directorio logs não existir no directorio actual (não perguntations) rebenta. +- servidor nao esta a lidar com eventos scroll/resize. ignorar? +- testar SSL # TODO -- SSL +- permitir varios testes, aluno escolhe qual o teste que quer fazer. - usar thread.Lock para aceder a variaveis de estado? -- servidor nao esta a lidar com eventos scroll/resize - se ocorrer um erro na correcçao avisar aluno para contactar o professor. -- implementar practice mode. -- usar http://wtfforms.com para radio e checkboxes -- abrir o teste numa janela maximizada e que nao permite que o aluno a redimensione/mova. +- implementar practice mode? +- abrir o teste numa janela maximizada e que nao permite que o aluno a redimensione/mova? - detectar scroll e enviar posição para servidor (analise de scroll para detectar copianço? ou simplesmente para analisar como os alunos percorrem o teste) - single page web no teste/correcçao. Página construída em javascript, obter perguntas com ajax (para practice?). - aviso na pagina principal para quem usa browser da treta -- permitir varios testes, aluno escolhe qual o teste que quer fazer. - criar perguntas de outros tipos, e.g. associação, ordenação, varios textinput - perguntas para professor corrigir mais tarde. - fazer uma calculadora javascript e por no menu. surge como modal - GeoIP? -- alunos online têm acesso a /correct e servidor rebenta. (não é fácil impedir...) - enviar logs para web? # FIXED +- se directorio "logs" não existir no directorio actual aborta com mensagem de erro. - se um teste tiver a mesma pergunta repetida (ref igual), rebenta na correcçao. As respostas são agregadas numa lista para cada ref. Ex: {'ref1': 'resposta1', 'ref2': ['resposta2a', 'resposta2b']} - usar http://fontawesome.io/examples/ em vez dos do bootstrap3 - se pergunta tiver 'type:' errado, rebenta. diff --git a/config/server.conf b/config/server.conf index 0b96183..e3cdf9a 100644 --- a/config/server.conf +++ b/config/server.conf @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- [global] -; environment= 'production' +environment= 'production' ; number of threads running server.thread_pool= 10 diff --git a/serve.py b/serve.py index 392235e..3ea09e3 100755 --- a/serve.py +++ b/serve.py @@ -310,14 +310,19 @@ if __name__ == '__main__': filename = path.abspath(path.expanduser(arg.testfile[0])) # --- Setup logging - logging.config.dictConfig(load_yaml(LOGGER_CONF)) + try: + logging.config.dictConfig(load_yaml(LOGGER_CONF)) + except: + print('An error ocurred while setting up the logging system.') + print('Common causes:\n - inexistent directory "logs"?\n - write permission to "logs" directory?') + sys.exit(1) # --- start application from app import App try: app = App(filename, vars(arg)) - except Exception as e: + except: logging.critical('Can\'t start application.') sys.exit(1) @@ -328,7 +333,6 @@ if __name__ == '__main__': # --- site wide configuration (valid for all apps) cherrypy.tools.secureheaders = cherrypy.Tool('before_finalize', secureheaders, priority=60) - cherrypy.config.update(arg.conf) # configuration file in /config conf = { '/': { diff --git a/static/bootstrap-3.3.7/.DS_Store b/static/bootstrap-3.3.7/.DS_Store deleted file mode 100644 index 97cc7ca..0000000 Binary files a/static/bootstrap-3.3.7/.DS_Store and /dev/null differ diff --git a/static/bootstrap-3.3.7/css/.DS_Store b/static/bootstrap-3.3.7/css/.DS_Store deleted file mode 100644 index daad639..0000000 Binary files a/static/bootstrap-3.3.7/css/.DS_Store and /dev/null differ -- libgit2 0.21.2