web/ldt/ldt_utils/fileimport.py
changeset 41 73753ea1dcef
parent 10 84e31387a741
child 57 3a3c15c462f8
--- a/web/ldt/ldt_utils/fileimport.py	Mon Jun 14 15:23:07 2010 +0200
+++ b/web/ldt/ldt_utils/fileimport.py	Tue Jun 15 00:25:30 2010 +0200
@@ -50,21 +50,18 @@
         if 'http' in self.src:
             url = urllib.urlopen(self.src)
             doc = xml.dom.minidom.parse(url)
-            doc = Ft.Xml.Domlette.ConvertDocument(doc)             
-            con = xml.xpath.Context.Context(doc, 1, 1, None)
-            #open .iri and get the title
-            res = xml.xpath.Evaluate("/iri/head/meta[@name='title']/@content", context=con)
-            self.title = res[0].value
-            
         #for import a zip, get title and copy file .iri in the media directory
         else:
             path = os.path.join(self.basepath, self.src)
             doc = xml.dom.minidom.parse(path)
-            
-            con = xml.xpath.Context.Context(doc, 1, 1, None)
-            
-            res = xml.xpath.Evaluate("/iri/head/meta[@name='title']/@content", context=con)
-            self.title = res[0].value
+        
+        
+        doc = Ft.Xml.Domlette.ConvertDocument(doc) 
+        con = xml.xpath.Context.Context(doc, 1, 1, None)
+        
+        res = xml.xpath.Evaluate("/iri/head/meta[@name='title']/@content", context=con)
+        self.title = res[0].value
+
             
         res = xml.xpath.Evaluate("/iri/body/ensembles",context=con)
         ensemblesnode = res[0]
@@ -105,7 +102,7 @@
 
         res = xml.xpath.Evaluate("/iri/body/medias/media[@id='video']/video", context=con)
         if self.flatten:
-            src_video = res[0].getAttribute('src')
+            src_video = res[0].getAttributeNS(None,'src')
             self.videourl = os.path.basename(src_video)
             res[0].setAttributeNS(None,'src', self.videourl)
         self.duration = res[0].getAttributeNS(None, u'dur')