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