correct utils.py for search to work.
authorcavaliet
Thu, 19 May 2011 15:07:14 +0200
changeset 115 d2cbc4c647dc
parent 114 279f1782c184
child 116 1f64d39734ed
correct utils.py for search to work.
src/ldt/ldt/ldt_utils/utils.py
--- a/src/ldt/ldt/ldt_utils/utils.py	Thu May 19 14:35:29 2011 +0200
+++ b/src/ldt/ldt/ldt_utils/utils.py	Thu May 19 15:07:14 2011 +0200
@@ -69,7 +69,7 @@
         medias = lxml.etree.SubElement(iri, u"medias")
         for content in contentList:
             videopath = unicode(settings.STREAM_URL)
-            if content.videopath :
+            if content.videopath != None :
                 videopath = unicode(content.videopath)
             media = lxml.etree.SubElement(medias, "media")
             media.set(u"id", content.iri_id)
@@ -81,7 +81,7 @@
         if projects is None:
             projects = []
         annotations_nodes = {}
-        for project in project:
+        for project in projects:
             ldtdoc = lxml.etree.fromstring(project.ldt.encode("utf-8"))
             res = ldtdoc.xpath("/iri/annotations/content")
 
@@ -98,19 +98,18 @@
 
         annotations = lxml.etree.SubElement(iri, "annotations")
         if len(annotations_nodes) > 0:
+            a = lxml.etree.SubElement(annotations, "a1")
             for content in contentList:
+                b = lxml.etree.SubElement(annotations, "b1")
                 if content.iri_id in annotations_nodes:
-                    contentnode = annotations_nodes[content.content_base.iri_id]
+                    b = lxml.etree.SubElement(annotations, "c1")
+                    contentnode = annotations_nodes[content.iri_id]
                     if contentnode is not None:
-                        if len(contentnode["ensembles"]) > 0:
-                            content_node = lxml.etree.SubElement(annotations, "content")
-                            content_node.set("id", contentnode["id"])
-                            content_node.text = u""
-                            for ens in contentnode["ensembles"]:
-                                content_node.append(ens)
-                        else:
-                            content_node = lxml.etree.SubElement(annotations, "content")
-                            content_node.set("id", contentnode["id"])
+                        content_node = lxml.etree.SubElement(annotations, "content")
+                        content_node.set("id", contentnode["id"])
+                        content_node.text = u""
+                        for ens in contentnode["ensembles"]:
+                            content_node.append(ens)
     
     
         displays = lxml.etree.SubElement(iri, "displays")