improve ldt generation for merging projects
authorymh <ymh.work@gmail.com>
Thu, 19 May 2011 10:38:36 +0200
changeset 113 cf3bdb2a4216
parent 112 9886ab183b09
child 114 279f1782c184
improve ldt generation for merging projects
src/ldt/ldt/ldt_utils/utils.py
src/ldt/ldt/ldt_utils/views.py
--- a/src/ldt/ldt/ldt_utils/utils.py	Wed May 18 19:17:39 2011 +0200
+++ b/src/ldt/ldt/ldt_utils/utils.py	Thu May 19 10:38:36 2011 +0200
@@ -54,7 +54,7 @@
 
 class LdtUtils(object):
     
-    def generateLdt(self, contentList, title=u"", author=u"IRI Web", web_url=u"", startSegment=None, contributions=None):
+    def generateLdt(self, contentList, title=u"", author=u"IRI Web", web_url=u"", startSegment=None, projects=None):
 
         iri = lxml.etree.Element(u'iri')
         doc = lxml.etree.ElementTree(iri)
@@ -77,11 +77,11 @@
             media.set(u"pict", u"")
             media.set(u"extra", u"")
     
-            if contributions is None:
-                contributions = []
+            if projects is None:
+                projects = []
             annotations_nodes = {}
-            for contrib in contributions:
-                ldtdoc = lxml.etree.fromstring(contrib.ldtproject.ldt.encode("utf-8"))
+            for project in project:
+                ldtdoc = lxml.etree.fromstring(project.ldt.encode("utf-8"))
                 res = ldtdoc.xpath("/iri/annotations/content")
     
                 for content in res:
--- a/src/ldt/ldt/ldt_utils/views.py	Wed May 18 19:17:39 2011 +0200
+++ b/src/ldt/ldt/ldt_utils/views.py	Thu May 19 10:38:36 2011 +0200
@@ -320,7 +320,22 @@
     
     if project_id and project_id != "_" :
         project = Project.objects.get(ldt_id=project_id) #@UndefinedVariable
+        ldtdoc = lxml.etree.fromstring(project.ldt.encode("utf-8"))
+#        display_nodes = ldtdoc.xpath("/iri/annotations/content")
 #TODO check that segment is in didplay
+#  <displays>
+#    <display id="0" title="generated" idsel="traces_2ac93c836fc4a00b36a77a356182210f" tc="0">
+#      <content id="traces_2ac93c836fc4a00b36a77a356182210f">
+#        <decoupage id="dp_1" idens="ensldt_2d8ab9b5975ef7721077034bb987cd43"/>
+#        <decoupage id="dp_2" idens="ensldt_2d8ab9b5975ef7721077034bb987cd43"/>
+#      </content>
+#      <activeSegment>
+#        <id idctt="traces_2ac93c836fc4a00b36a77a356182210f" idens="ensldt_2d8ab9b5975ef7721077034bb987cd43" idcut="dp_1" idseg="dp_1_sp_105"/>
+#      </activeSegment>
+#    </display>
+#  </displays>
+
+
         resp.write(project.ldt)
     else:
         # generate ldt from