web/ldt/ldt_utils/fileimport.py
changeset 10 84e31387a741
parent 5 ae8593287883
child 41 73753ea1dcef
child 54 24397932219d
--- a/web/ldt/ldt_utils/fileimport.py	Thu Jun 10 04:16:26 2010 +0200
+++ b/web/ldt/ldt_utils/fileimport.py	Thu Jun 10 11:17:09 2010 +0200
@@ -73,7 +73,7 @@
 
         for node in ensemblesnode.childNodes:
             if node.nodeType == xml.dom.Node.ELEMENT_NODE and node.tagName == "ensemble":
-                id = node.getAttributeNS("id",None)
+                id = node.getAttributeNS(None,u"id")
                 if id not in ensembleids:
                     ensembleids.append(id)
 
@@ -108,7 +108,7 @@
             src_video = res[0].getAttribute('src')
             self.videourl = os.path.basename(src_video)
             res[0].setAttributeNS(None,'src', self.videourl)
-        self.duration = res[0].getAttributeNS(None, 'dur')
+        self.duration = res[0].getAttributeNS(None, u'dur')
             
         f = open(path, "w")
         try:
@@ -130,7 +130,7 @@
         #    url = self.src
         #else:
         #    url = self.id + u"/" + os.path.basename(self.src)
-        content, self.created = Content.objects.get_or_create(iri_id=self.id, defaults = {'iriurl': self.src, 'title':self.title, 'description':self.desc, 'videopath': self.videopath})
+        content, self.created = Content.objects.get_or_create(iri_id=self.id, defaults = {'src':self.videourl, 'iriurl': self.src, 'title':self.title, 'description':self.desc, 'videopath': self.videopath})
         if not self.created:
             content.iriurl = self.src
             content.title = self.title
@@ -266,7 +266,7 @@
         #get author from file ldt
         result = xml.xpath.Evaluate("/iri/project", context=con)
         for pnode in result:
-            author = pnode.getAttributeNS("user",None)
+            author = pnode.getAttributeNS(None,u"user")
             if author:
                 self.author = unicode(author)
                 break