[pitivi: 10/41] formatter: Make sure to have same char encoding format when comparing URI



commit d6e937f1427cf2d29ea8c0f4b47c13efc83ae24a
Author: Thibault Saunier <thibault saunier collabora com>
Date:   Sun Aug 7 17:23:59 2011 +0200

    formatter: Make sure to have same char encoding format when comparing URI

 pitivi/formatters/base.py |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/formatters/base.py b/pitivi/formatters/base.py
index b7510c8..e4dbe95 100644
--- a/pitivi/formatters/base.py
+++ b/pitivi/formatters/base.py
@@ -388,11 +388,21 @@ class Formatter(Signallable, Loggable):
     def _searchMissingFile(self, uri):
         """Search for a replacement for the specified file:// URI."""
         for old_prefix, new_prefix in self.directorymapping.iteritems():
-            self.debug("uri:%r, k:%r, v:%r", uri, old_prefix, new_prefix)
+            self.debug("uri:%r, old prefix:%r, new prefix:%r", uri,
+                     old_prefix, new_prefix)
+            uri = unquote(uri)
+            old_prefix = unquote(old_prefix)
+            print uri
+            print old_prefix
             if uri.startswith(old_prefix):
+                uri = quote(uri)
+                old_prefix = quote(old_prefix)
                 probable = uri.replace(old_prefix, new_prefix, 1)
                 if uri_is_valid(probable) and uri_is_reachable(probable):
                     return probable
+            uri = quote(uri)
+            old_prefix = quote(old_prefix)
+
         return None
 
     #}



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