Merge with 398c70610f99681f36f651930c64c384f188716a
authorcavaliet
Fri, 13 Jan 2012 18:20:18 +0100
changeset 390 4b67ef97438f
parent 389 a32ce3533447 (diff)
parent 387 398c70610f99 (current diff)
child 391 b5c0d6a45f28
Merge with 398c70610f99681f36f651930c64c384f188716a
.project
src/ldt/ldt/ldt_utils/utils.py
--- a/.project	Fri Jan 13 17:39:33 2012 +0100
+++ b/.project	Fri Jan 13 18:20:18 2012 +0100
@@ -1,17 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>platform_group</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>com.aptana.ide.core.unifiedBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>com.aptana.projects.webnature</nature>
-	</natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>platform_group</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.python.pydev.PyDevBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.aptana.ide.core.unifiedBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.aptana.projects.webnature</nature>
+		<nature>org.python.pydev.pythonNature</nature>
+	</natures>
+</projectDescription>
--- a/src/ldt/ldt/api/ldt/handlers.py	Fri Jan 13 17:39:33 2012 +0100
+++ b/src/ldt/ldt/api/ldt/handlers.py	Fri Jan 13 18:20:18 2012 +0100
@@ -165,7 +165,7 @@
             for a in new_annotations:
                 dur = str(a['end'] - a['begin'])
                 begin = str(a['begin'])
-                new_id = adder.add(a['media'], a['type'], a['type_title'], a['content']['data'], '', a['tags'], begin, dur, author, date)
+                type_id, new_id = adder.add(a['media'], a['type'], a['type_title'], a['content']['data'], '', a['tags'], begin, dur, author, date)
                 if not new_id:
                     protect_instance(project)
                     return rc.BAD_REQUEST
@@ -175,7 +175,9 @@
                 unprotect_instance(content)
                 add_annotation_to_stat(content, project, a['begin'], a['end'])
                 protect_instance(content)
-                    
+                
+                # We update the ids
+                a['type'] = type_id
                 a['id'] = new_id
             
             # We save if there were added annotation
--- a/src/ldt/ldt/ldt_utils/utils.py	Fri Jan 13 17:39:33 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/utils.py	Fri Jan 13 18:20:18 2012 +0100
@@ -171,7 +171,7 @@
         self.to_add = True
         
     #   add( a['media'], a['type'],  a['type_title, a[data], '', a['tags'], begin, dur, author, date)
-    def add(self, media, cutting_id, cutting_title, title, text, tags_list, begin, dur, author, date, view_id=None, color="16776960"):
+    def add(self, media, cutting_id, cutting_title, title, text, tags_list, begin, dur, author, date, view_id="0", color="2194379"):
         """
         Add an annotation to a project. begin and dur must be strings. Default color is yellow.
         """
@@ -202,7 +202,8 @@
             path_ensemble = lxml.etree.SubElement(path_content[0], 'ensemble')
             path_ensemble.set('id', 'g_' + generate_uuid())
             path_ensemble.set('title', _('Personal cutting'))
-            path_ensemble.set('author', 'undefined')
+            path_ensemble.set('author', 'IRI')
+            path_ensemble.set('abstract', 'IRI')
             path_ensemble = [path_ensemble]
         #else:
         #    path_ensemble = path_content[0].xpath('ensemble')
@@ -264,7 +265,7 @@
             tag_node = lxml.etree.SubElement(tags, 'tag')
             tag_node.text = tag
         
-        return id_annotation
+        return cutting_id, id_annotation
     
     def save(self):
         if self.to_add: