From 8f6029219d36736b57f14fb2650969ed4c13a4f1 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sat, 6 Oct 2007 04:35:15 +0000 Subject: [PATCH] Fix adding torrents with a unicode save_path. --- deluge/common.py | 2 +- deluge/config.py | 4 ++-- deluge/core/torrentmanager.py | 2 +- deluge/ui/gtkui/pluginmanager.py | 9 +++++++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/deluge/common.py b/deluge/common.py index b044da775..e0cb2900c 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -187,6 +187,6 @@ def pythonize(var): ) for klass in [unicode, str, bool, int, float, long]: - if isinstance(var,klass): + if isinstance(var, klass): return klass(var) return var diff --git a/deluge/config.py b/deluge/config.py index bbb9dd6ed..6afc95fdf 100644 --- a/deluge/config.py +++ b/deluge/config.py @@ -113,7 +113,7 @@ class Config: """Set the 'key' with 'value'.""" # Sets the "key" with "value" in the config dict if self.config[key] != value: - log.debug("Setting '%s' to %s", key, value) + log.debug("Setting '%s' to %s of type %s", key, type(value), value) self.config[key] = value # Run the set_function for this key if any try: @@ -128,7 +128,7 @@ class Config: # invalid try: value = self.config[key] - log.debug("Getting '%s' as %s", key, value) + log.debug("Getting '%s' as %s of type %s", key, value, type(value)) return value except KeyError: log.warning("Key does not exist, returning None") diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index d61057e32..a1c62025d 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -173,7 +173,7 @@ class TorrentManager: try: handle = self.session.add_torrent( lt.torrent_info(torrent_filedump), - save_path, + str(save_path), resume_data=fastresume, compact_mode=compact, paused=paused) diff --git a/deluge/ui/gtkui/pluginmanager.py b/deluge/ui/gtkui/pluginmanager.py index 07cbe1ca2..9c46ada4f 100644 --- a/deluge/ui/gtkui/pluginmanager.py +++ b/deluge/ui/gtkui/pluginmanager.py @@ -32,13 +32,22 @@ # statement from all source files in the program, then also delete it here. import deluge.pluginmanagerbase +import deluge.ui.functions as functions +from deluge.configmanager import ConfigManager from deluge.log import LOG as log class PluginManager(deluge.pluginmanagerbase.PluginManagerBase): def __init__(self, gtkui): + self.config = ConfigManager("gtkui.conf") self._gtkui = gtkui + # Update the enabled_plugins from the core + enabled_plugins = functions.get_enabled_plugins() + enabled_plugins += self.config["enabled_plugins"] + enabled_plugins = list(set(enabled_plugins)) + self.config["enabled_plugins"] = enabled_plugins + deluge.pluginmanagerbase.PluginManagerBase.__init__( self, "gtkui.conf", "deluge.plugin.ui.gtk")