From 47029a4e1fc329f2d69bf5b39df640f016ebdad6 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 2 Sep 2012 10:55:42 -0400 Subject: [PATCH] handler:get: only add comment to submission response if it exists. This avoids potentially confusing responses like: > Assignment 1 grade: 8.0 > > None --- pygrader/handler/get.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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: -- 2.26.2