minor correction to avoid error when search result is empty
authorrougeronj
Thu, 06 Dec 2012 14:48:20 +0100
changeset 1019 d665c0b9dac0
parent 1018 881fdf413942
child 1020 f3205dfbeb4f
minor correction to avoid error when search result is empty
src/ldt/ldt/ldt_utils/views/workspace.py
--- a/src/ldt/ldt/ldt_utils/views/workspace.py	Wed Dec 05 13:22:49 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/workspace.py	Thu Dec 06 14:48:20 2012 +0100
@@ -280,9 +280,11 @@
     results.sort(key=lambda k: k['iri_id'])
            
     for iri_id, item in groupby(results, itemgetter('iri_id')):
-        content = filter(lambda e: e.iri_id == iri_id, all_contents)[0]
-        if content.description is None:
-            content.description = ''
+        content_filter = filter(lambda e: e.iri_id == iri_id, all_contents)
+        if len(content_filter)>0:
+            content = filter(lambda e: e.iri_id == iri_id, all_contents)[0]
+            if content.description is None:
+                content.description = ''
                     
         all_related_segments = list(item)