summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-09-11 11:28:35 +0200
committerTimotej Lazar <timotej.lazar@araneo.org>2015-09-11 11:28:35 +0200
commitd1d652fd1ce39d09ac0fd379cd1455ed9ebd2660 (patch)
tree55614119046ec228125123129317a79ac62aba8e /server
parent7a923e0e4dc80b0642259ed8250f4b62aeb9684c (diff)
Pass PythonSession.run to hint and test functions
No other session stuff is needed (for now).
Diffstat (limited to 'server')
-rw-r--r--server/python_session.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/server/python_session.py b/server/python_session.py
index 87ae60f..4af455f 100644
--- a/server/python_session.py
+++ b/server/python_session.py
@@ -66,16 +66,15 @@ class PythonSession(object):
self._interpreter = None
def hint(self, sid, problem_id, program):
- session = server.user_session.get_session_by_id(sid)
language, problem_group, problem = Problem.get_identifier(problem_id)
language_module = problems.load_language(language, 'common')
problem_module = problems.load_problem(language, problem_group, problem, 'common')
hints = []
if hasattr(language_module, 'hint'):
- hints = language_module.hint(program)
+ hints = language_module.hint(self.run, program)
if not hints and hasattr(problem_module, 'hint'):
- hints = problem_module.hint(session, program)
+ hints = problem_module.hint(self.run, program)
if not hints:
hints = [{'id': 'no_hint'}]
@@ -83,13 +82,12 @@ class PythonSession(object):
return hints
def test(self, sid, problem_id, program):
- session = server.user_session.get_session_by_id(sid)
language, problem_group, problem = Problem.get_identifier(problem_id)
language_module = problems.load_language(language, 'common')
problem_module = problems.load_problem(language, problem_group, problem, 'common')
try:
- n_correct, n_all = problem_module.test(session, program)
+ n_correct, n_all = problem_module.test(self.run, program)
hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': n_all}}]
except AttributeError as ex:
hints = [{'id': 'test_results', 'args': {'passed': 0, 'total': 0}}]