Commit d895857fda129ff3f3d0b99633b3f7c8532531de

Authored by Miguel Barão
1 parent f8dd6379
Exists in master and in 1 other branch dev

- fixed debug code. Added alias keys in templates to match the ones defined in questions.

Showing 2 changed files with 15 additions and 11 deletions   Show diff stats
app.py
... ... @@ -34,7 +34,7 @@ class LearnApp(object):
34 34 self.online = {}
35 35  
36 36 # build dependency graph
37   - self.build_dependency_graph(conffile) # FIXME
  37 + self.build_dependency_graph(conffile)
38 38  
39 39 # connect to database and check registered students
40 40 self.db_setup(self.depgraph.graph['database']) # FIXME
... ... @@ -167,6 +167,7 @@ class LearnApp(object):
167 167 # ------------------------------------------------------------------------
168 168 # Receives a set of topics (strings like "math/algebra"),
169 169 # and recursively adds dependencies to the dependency graph
  170 + # ------------------------------------------------------------------------
170 171 def build_dependency_graph(self, config_file):
171 172  
172 173 # Load configuration file
... ...
serve.py
... ... @@ -35,21 +35,21 @@ from tools import load_yaml, md
35 35 class WebApplication(tornado.web.Application):
36 36 def __init__(self, learnapp, debug=False):
37 37 handlers = [
38   - (r'/login', LoginHandler),
39   - (r'/logout', LogoutHandler),
  38 + (r'/login', LoginHandler),
  39 + (r'/logout', LogoutHandler),
40 40 (r'/change_password', ChangePasswordHandler),
41   - (r'/question', QuestionHandler),
42   - (r'/', LearnHandler),
43   - (r'/(.+)', FileHandler),
  41 + (r'/question', QuestionHandler),
  42 + (r'/', LearnHandler),
  43 + (r'/(.+)', FileHandler),
44 44 ]
45 45 settings = {
46 46 'template_path': os.path.join(os.path.dirname(__file__), 'templates'),
47 47 'static_path': os.path.join(os.path.dirname(__file__), 'static'),
48   - 'static_url_prefix': '/static/', # this is the default
  48 + 'static_url_prefix': '/static/',
49 49 'xsrf_cookies': False, # FIXME see how to do it...
50 50 'cookie_secret': base64.b64encode(uuid.uuid4().bytes),
51 51 'login_url': '/login',
52   - 'debug': True,
  52 + 'debug': debug,
53 53 }
54 54 super().__init__(handlers, **settings)
55 55 self.learn = learnapp
... ... @@ -147,14 +147,17 @@ class QuestionHandler(BaseHandler):
147 147 'radio': 'question-radio.html',
148 148 'text': 'question-text.html',
149 149 'text_regex': 'question-text.html',
  150 + 'text-regex': 'question-text.html',
150 151 'text_numeric': 'question-text.html',
  152 + 'text-numeric': 'question-text.html',
151 153 'textarea': 'question-textarea.html',
152 154 # -- information panels --
153 155 'information': 'question-information.html',
154 156 'info': 'question-information.html',
155 157 'success': 'question-success.html',
156   - # 'warning': '', FIXME
157   - # 'alert': '', FIXME
  158 + # 'warning': '', FIXME
  159 + # 'warn': '', FIXME
  160 + # 'alert': '', FIXME
158 161 }
159 162  
160 163 @tornado.web.authenticated
... ... @@ -203,7 +206,7 @@ def main():
203 206 argparser.add_argument('conffile', type=str, nargs='+',
204 207 help='Topics configuration file in YAML format.') # FIXME only one
205 208 argparser.add_argument('--debug', action='store_true',
206   - help='Enable debug logging.') # FIXME not implemented
  209 + help='Enable webserver debug (not debug logging).')
207 210 arg = argparser.parse_args()
208 211  
209 212 # --- Setup logging
... ...