Little correction on project API.
--- a/src/ldt/ldt/api/ldt/handlers.py Fri Jan 06 11:28:10 2012 +0100
+++ b/src/ldt/ldt/api/ldt/handlers.py Fri Jan 06 15:39:01 2012 +0100
@@ -47,7 +47,7 @@
Example of ajax call with 2 differents annotations :
$('#mon_ajax').click(function(e) {
- var url = "{% url project_api project_id='c8448f21-272d-11e1-876b-c8bcc896c290.' emitter_format='json' %}";
+ var url = "{% url project_api project_id='c8448f21-272d-11e1-876b-c8bcc896c290' emitter_format='.json' %}"; // Don't forget the "." before "json" !
var monjson = '{\
"annotations": [\
@@ -144,7 +144,7 @@
}
"""
- #return rc.ALL_OK
+
#assert False, " TIBO str(request.data) = " + str(request.data)
if request.content_type.lower().find("application/json") > -1 :
try:
@@ -166,8 +166,10 @@
new_id = adder.add(a['media'], a['type'], a['type_title'], a['content']['data'], '', a['tags'], begin, dur, author, date)
if not new_id:
return rc.BAD_REQUEST
+ a['id'] = new_id
+ # We save if there were added annotation
+ if len(new_annotations)>0 :
adder.save()
- a['id'] = new_id
return request.data
--- a/src/ldt/ldt/ldt_utils/utils.py Fri Jan 06 11:28:10 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/utils.py Fri Jan 06 15:39:01 2012 +0100
@@ -251,6 +251,7 @@
element.set('author', author)
element.set('date', date)
element.set('color', color)
+ element.set('src', "")
abstract = lxml.etree.SubElement(element, 'abstract')
abstract.text = text
title_node = lxml.etree.SubElement(element, 'title')
@@ -273,6 +274,7 @@
self.project.save_base()
else:
self.project.save()
+ return True
def __del__(self):
self.save()