[pitivi/ges: 222/287] medialibrary: Use quote_uri systematically to prevent errors



commit 40b1149a72fe774fe8ffee7727ac2280b433daf8
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Sat Jan 14 16:07:53 2012 -0500

    medialibrary: Use quote_uri systematically to prevent errors

 pitivi/medialibrary.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index c8d2a98..1a15717 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -196,6 +196,9 @@ class MediaLibrary(Signallable, Loggable):
         """
         Remove the info for c{uri} from the source list.
         """
+        # In theory we don't need quote_uri here, but since removeUri is public,
+        # we can never be too sure.
+        uri = quote_uri(uri)
         try:
             info = self._sources.pop(uri)
         except KeyError:
@@ -214,6 +217,9 @@ class MediaLibrary(Signallable, Loggable):
         """
         Get the source corresponding to C{uri}.
         """
+        # Make sure the URI is properly quoted, as other modules calling this
+        # method do not necessarily provide URIs encoded in the same way.
+        uri = quote_uri(uri)
         info = self._sources.get(uri)
         if info is None:
             raise MediaLibraryError("URI not in the medialibrary", uri)
@@ -1258,8 +1264,7 @@ class MediaLibraryWidget(gtk.VBox, Loggable):
             #TODO waiting for remote files downloader support to be implemented
             pass
 
-        uris = [quote_uri(uri) for uri in filenames]
-        self.app.current.medialibrary.addUris(uris)
+        self.app.current.medialibrary.addUris(filenames)
 
     #used with TreeView and IconView
     def _dndDragBeginCb(self, view, context):



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