Fix adding torrents with a unicode save_path.

This commit is contained in:
Andrew Resch 2007-10-06 04:35:15 +00:00
commit 8f6029219d
4 changed files with 13 additions and 4 deletions

View file

@ -187,6 +187,6 @@ def pythonize(var):
) )
for klass in [unicode, str, bool, int, float, long]: for klass in [unicode, str, bool, int, float, long]:
if isinstance(var,klass): if isinstance(var, klass):
return klass(var) return klass(var)
return var return var

View file

@ -113,7 +113,7 @@ class Config:
"""Set the 'key' with 'value'.""" """Set the 'key' with 'value'."""
# Sets the "key" with "value" in the config dict # Sets the "key" with "value" in the config dict
if self.config[key] != value: 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 self.config[key] = value
# Run the set_function for this key if any # Run the set_function for this key if any
try: try:
@ -128,7 +128,7 @@ class Config:
# invalid # invalid
try: try:
value = self.config[key] 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 return value
except KeyError: except KeyError:
log.warning("Key does not exist, returning None") log.warning("Key does not exist, returning None")

View file

@ -173,7 +173,7 @@ class TorrentManager:
try: try:
handle = self.session.add_torrent( handle = self.session.add_torrent(
lt.torrent_info(torrent_filedump), lt.torrent_info(torrent_filedump),
save_path, str(save_path),
resume_data=fastresume, resume_data=fastresume,
compact_mode=compact, compact_mode=compact,
paused=paused) paused=paused)

View file

@ -32,13 +32,22 @@
# statement from all source files in the program, then also delete it here. # statement from all source files in the program, then also delete it here.
import deluge.pluginmanagerbase import deluge.pluginmanagerbase
import deluge.ui.functions as functions
from deluge.configmanager import ConfigManager
from deluge.log import LOG as log from deluge.log import LOG as log
class PluginManager(deluge.pluginmanagerbase.PluginManagerBase): class PluginManager(deluge.pluginmanagerbase.PluginManagerBase):
def __init__(self, gtkui): def __init__(self, gtkui):
self.config = ConfigManager("gtkui.conf")
self._gtkui = gtkui 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__( deluge.pluginmanagerbase.PluginManagerBase.__init__(
self, "gtkui.conf", "deluge.plugin.ui.gtk") self, "gtkui.conf", "deluge.plugin.ui.gtk")