Commit e07f3a34ad8adad609a80cca0b3de71b2a45ae99
1 parent
2086b774
Exists in
master
and in
1 other branch
- prevent going to /results when not in practice mode.
Showing
1 changed file
with
6 additions
and
3 deletions
Show diff stats
serve.py
| ... | ... | @@ -63,9 +63,12 @@ class Root(object): |
| 63 | 63 | # --- RESULTS ------------------------------------------------------------ |
| 64 | 64 | @cherrypy.expose |
| 65 | 65 | def results(self): |
| 66 | - r = self.database.test_grades(self.testconf['ref']) | |
| 67 | - template = self.templates.get_template('results.html') | |
| 68 | - return template.render(t=self.testconf, results=r) | |
| 66 | + if self.testconf.get('practice', False): | |
| 67 | + r = self.database.test_grades(self.testconf['ref']) | |
| 68 | + template = self.templates.get_template('results.html') | |
| 69 | + return template.render(t=self.testconf, results=r) | |
| 70 | + else: | |
| 71 | + raise cherrypy.HTTPRedirect('/') | |
| 69 | 72 | |
| 70 | 73 | # --- TEST --------------------------------------------------------------- |
| 71 | 74 | @cherrypy.expose | ... | ... |