Browse Source

[jobsub] Filter out designs without a document. Empty documents will break the editor.

krish 11 years ago
parent
commit
4310671728
1 changed files with 14 additions and 13 deletions
  1. 14 13
      apps/jobsub/src/jobsub/views.py

+ 14 - 13
apps/jobsub/src/jobsub/views.py

@@ -69,19 +69,20 @@ def _list_designs(request, owner, name, order_by='-last_modified'):
   for doc in data[:MAX_DESIGNS]:
     design = doc.content_object
 
-    ko_design = {
-      'id': design.id,
-      'owner': design.owner.username,
-      # Design name is validated by workflow and node forms.
-      'name': design.name,
-      'description': design.description,
-      'node_type': design.start.get_child('to').node_type,
-      'last_modified': py_time.mktime(design.last_modified.timetuple()),
-      'editable': design.owner.id == request.user.id,
-      'is_shared': design.is_shared,
-      'is_trashed': doc.is_trashed()
-    }
-    designs.append(ko_design)
+    if design is not None:
+      ko_design = {
+       'id': design.id,
+       'owner': design.owner.username,
+       # Design name is validated by workflow and node forms.
+       'name': design.name,
+       'description': design.description,
+       'node_type': design.start.get_child('to').node_type,
+       'last_modified': py_time.mktime(design.last_modified.timetuple()),
+       'editable': design.owner.id == request.user.id,
+       'is_shared': design.is_shared,
+       'is_trashed': doc.is_trashed()
+      }
+      designs.append(ko_design)
 
   return designs