Last active
November 12, 2015 22:16
-
-
Save ricomoss/86e7b9f5f5247b292240 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a bit messy | |
try: | |
program = student_schedule.zm_course.program | |
except AttributeError: | |
if program is None: | |
print("warning, could not add to class resource due to old model") | |
return | |
else: | |
program = program | |
if program is None: | |
print("warning, could not add to class resource due to old model") | |
return | |
# Replace above with: | |
if student_schedule.zm_course and student_schedule.zm_course.program: | |
program = student_schedule.zm_course.program | |
elif not program: | |
# This is an old model | |
return | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment