From: W. Trevor King Date: Sun, 2 Sep 2012 14:55:42 +0000 (-0400) Subject: handler:get: only add comment to submission response if it exists. X-Git-Tag: v0.3~17 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=47029a4e1fc329f2d69bf5b39df640f016ebdad6;p=pygrader.git handler:get: only add comment to submission response if it exists. This avoids potentially confusing responses like: > Assignment 1 grade: 8.0 > > None --- diff --git a/pygrader/handler/get.py b/pygrader/handler/get.py index e354d2a..24d79c4 100644 --- a/pygrader/handler/get.py +++ b/pygrader/handler/get.py @@ -419,9 +419,10 @@ def _get_student_submission_email( for assignment in assignments: grade = course.grade(student=student, assignment=assignment) if grade is not None: - message.attach(_pgp_mime.encodedMIMEText( - '{} grade: {}\n\n{}\n'.format( - assignment.name, grade.points, grade.comment))) + text = '{} grade: {}\n'.format(assignment.name, grade.points) + if grade.comment: + text += '\n{}\n'.format(grade.comment) + message.attach(_pgp_mime.encodedMIMEText(text)) assignment_path = _assignment_path(basedir, assignment, student) mpath = _os_path.join(assignment_path, 'mail') try: