From d1d652fd1ce39d09ac0fd379cd1455ed9ebd2660 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Fri, 11 Sep 2015 11:28:35 +0200 Subject: Pass PythonSession.run to hint and test functions No other session stuff is needed (for now). --- server/python_session.py | 8 +++----- 1 file 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}}] -- cgit v1.2.1