]> git.parisson.com Git - teleforma.git/commitdiff
fix no results for course pull
authoryomguy <yomguy@parisson.com>
Wed, 19 Feb 2014 01:17:52 +0000 (02:17 +0100)
committeryomguy <yomguy@parisson.com>
Wed, 19 Feb 2014 01:17:52 +0000 (02:17 +0100)
teleforma/views/core.py

index 12e52ab14d75ee42a7651e4f592db0323a9bed3d..8ba80c6c27ad2d37433a3923182a8fcb9adf33a5 100644 (file)
@@ -249,13 +249,14 @@ class CourseListView(CourseAccessMixin, ListView):
             url = 'http://' + department.domain + '/json/'
             s = ServiceProxy(url)
             remote_list = s.teleforma.get_course_list(organization_name, department.name)
-            for course_dict in remote_list['result']:
-                course = Course.objects.filter(code=course_dict['code'], department=department)
-                if not course:
-                    course = Course()
-                else:
-                    course = course[0]
-                course.from_dict(course_dict)
+            if remote_list['result']:
+                for course_dict in remote_list['result']:
+                    course = Course.objects.filter(code=course_dict['code'], department=department)
+                    if not course:
+                        course = Course()
+                    else:
+                        course = course[0]
+                    course.from_dict(course_dict)
                 
     @jsonrpc_method('teleforma.get_dep_courses')
     def get_dep_courses(request, id):