FinalsClub / karmaworld

KarmaNotes.org v3.0
GNU Affero General Public License v3.0
7 stars 6 forks source link

random error on the staging machine #386

Open btbonval opened 9 years ago

btbonval commented 9 years ago
2015-01-09T22:34:27.494976+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py", line 113, in get_response
2015-01-09T22:34:27.494981+00:00 app[web.1]:   File "/app/karmaworld/apps/courses/views.py", line 323, in course_list_ajax
2015-01-09T22:34:27.494983+00:00 app[web.1]:   File "/app/karmaworld/utils/ajax_utils.py", line 17, in ajax_base
2015-01-09T22:34:27.494982+00:00 app[web.1]:     return ajax_base(request, course_list_ajax_handler, ['GET'])
2015-01-09T22:34:27.494977+00:00 app[web.1]:     response = callback(request, *callback_args, **callback_kwargs)
2015-01-09T22:34:27.494985+00:00 app[web.1]:     resp = event_processor(request)
2015-01-09T22:34:27.494987+00:00 app[web.1]:     ] for course in objects
2015-01-09T22:34:27.494979+00:00 app[web.1]:     return wrapped(*args, **kwargs)
2015-01-09T22:34:27.494991+00:00 app[web.1]: AttributeError: 'NoneType' object has no attribute 'school'
2015-01-09T22:34:27.494989+00:00 app[web.1]:   File "/app/karmaworld/apps/courses/views.py", line 245, in course_json
2015-01-09T22:34:27.494990+00:00 app[web.1]:     'school': course.school.name if course.school else course.department.school.name,
2015-01-09T22:34:27.494986+00:00 app[web.1]:   File "/app/karmaworld/apps/courses/views.py", line 309, in course_list_ajax_handler
btbonval commented 9 years ago

might be a fluke, happened around when I shut down the system. Looking at the code, it looks like the only way the error could appear is if course_json is called when an empty course (None) or the course has neither school nor department. https://github.com/FinalsClub/karmaworld/blob/master/karmaworld/apps/courses/views.py#L245