Skip to content

Commit

Permalink
web_services: callback: define VMCHECKER_HOME in apache conf
Browse files Browse the repository at this point in the history
If HOME variable is not defined (which can happen depending on the setup)
then the callback functions will fail because the search path for the key is
relative to this variable.

Signed-off-by: Lucian Cojocar <cojocar@gmail.com>
  • Loading branch information
cojocar committed Aug 11, 2014
1 parent 6717606 commit e798549
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions web_services/services.py
Expand Up @@ -39,6 +39,9 @@
ERR_OTHER = 3


def __fixup_env(req):
if 'HOME' not in os.environ:
os.environ['HOME'] = req.get_options()["VMCHECKER_HOME"]

########## @ServiceMethod
def uploadedFile(req, courseId, assignmentId, tmpname):
Expand Down Expand Up @@ -73,6 +76,7 @@ def uploadedFile(req, courseId, assignmentId, tmpname):
strout = websutil.OutputString()
sys.stdout = strout
try:
__fixup_env(req)
submit.submit(tmpname, assignmentId, username, courseId)
update_db.update_grades(courseId, user=username, assignment=assignmentId)
except submit.SubmittedTooSoonError:
Expand Down Expand Up @@ -136,6 +140,7 @@ def uploadAssignment(req, courseId, assignmentId, archiveFile):
strout = websutil.OutputString()
sys.stdout = strout
try:
__fixup_env(req)
submit.submit(tmpname, assignmentId, username, courseId)
update_db.update_grades(courseId, user=username, assignment=assignmentId)
except submit.SubmittedTooSoonError:
Expand Down Expand Up @@ -192,6 +197,7 @@ def uploadAssignmentMd5(req, courseId, assignmentId, md5Sum):
strout = websutil.OutputString()
sys.stdout = strout
try:
__fixup_env(req)
submit.submit(tmpname, assignmentId, username, courseId)
update_db.update_grades(courseId, user=username, assignment=assignmentId)
except submit.SubmittedTooSoonError:
Expand Down Expand Up @@ -249,6 +255,7 @@ def beginEvaluation(req, courseId, assignmentId, archiveFileName):
sys.stdout = strout

try:
__fixup_env(req)
submit.evaluate_large_submission(archiveFileName, assignmentId, username, courseId)
except submit.SubmittedTooSoonError:
traceback.print_exc(file = strout)
Expand Down

0 comments on commit e798549

Please sign in to comment.