[pitivi] Fix loading of utf8 encoded source filenames.



commit 2450cb95e051fd2faf3bd897e3655d6c8f8d2734
Author: Alessandro Decina <alessandro d gmail com>
Date:   Fri Aug 21 13:26:28 2009 +0200

    Fix loading of utf8 encoded source filenames.

 pitivi/formatters/etree.py |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/formatters/etree.py b/pitivi/formatters/etree.py
index 8f6d70f..9d6a895 100644
--- a/pitivi/formatters/etree.py
+++ b/pitivi/formatters/etree.py
@@ -167,8 +167,10 @@ class ElementTreeFormatter(Formatter):
         # FIXME : we should check if the given ObjectFactory
         # requires a filename !
         filename = element.attrib.get("filename", None)
-
         if filename is not None:
+            if isinstance(filename, unicode):
+                filename = filename.encode("utf-8")
+
             factory = klass(filename)
         else:
             factory = klass()
@@ -187,9 +189,10 @@ class ElementTreeFormatter(Formatter):
             factory.addOutputStream(stream)
 
         if filename is not None:
-            if isinstance(filename, unicode):
-                filename = filename.encode("utf-8")
-            filename = self.validateSourceURI(filename, factory)
+            filename1 = self.validateSourceURI(filename, factory)
+            if filename != filename1:
+                # the file was moved
+                factory.uri = factory.filename = filename
 
         self._context.factories[element.attrib["id"]] = factory
         return factory



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]