# HG changeset patch # User cavaliet # Date 1305810434 -7200 # Node ID d2cbc4c647dc2f8120de9ccba24a2a5d2e10d7f3 # Parent 279f1782c184b1c93fb4552353565870e390b997 correct utils.py for search to work. diff -r 279f1782c184 -r d2cbc4c647dc 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")