better place for cinelab json validation
authorcavaliet
Tue, 11 Jun 2013 17:34:43 +0200
changeset 1202 e9fa445e2c4d
parent 1201 d769f4623374
child 1203 c8b1ee386f83
better place for cinelab json validation
src/ldt/ldt/api/ldt/serializers/cinelabserializer.py
--- a/src/ldt/ldt/api/ldt/serializers/cinelabserializer.py	Fri May 31 15:48:41 2013 +0200
+++ b/src/ldt/ldt/api/ldt/serializers/cinelabserializer.py	Tue Jun 11 17:34:43 2013 +0200
@@ -60,6 +60,9 @@
         """
         
         cinelab = simplejson.loads(content)
+        # We validate the json
+        self.validate_cinelab_json(cinelab)
+        # We search if the id is set
         meta = cinelab["meta"]
         if "id" in meta and meta["id"]!="":
             ldt_id = meta["id"]
@@ -84,8 +87,7 @@
     
     
     def cinelab_to_ldt(self, cinelab, ldt_id=None):
-        # We validate the json
-        self.validate_cinelab_json(cinelab)
+        # We suppose that the cinelab json has been validated
         # Start xml
         meta = cinelab["meta"]
         annotation_types = cinelab["annotation-types"]