diff --git a/deluge/config.py b/deluge/config.py index ded4b15bd..f63b31c7a 100644 --- a/deluge/config.py +++ b/deluge/config.py @@ -72,12 +72,11 @@ import logging import shutil import os -from twisted.internet.reactor import callLater - import deluge.common json = deluge.common.json log = logging.getLogger(__name__) +callLater = None # Necessary for the config tests def prop(func): """Function decorator for defining property attributes @@ -219,6 +218,11 @@ what is currently in the config and it could not convert the value log.debug("Setting '%s' to %s of %s", key, value, type(value)) self.__config[key] = value + + global callLater + if callLater is None: + # Must import here and not at the top or it will throw ReactorAlreadyInstalledError + from twisted.internet.reactor import callLater # Run the set_function for this key if any try: for func in self.__set_functions[key]: diff --git a/deluge/ui/client.py b/deluge/ui/client.py index 650dcfa45..a2a5136c7 100644 --- a/deluge/ui/client.py +++ b/deluge/ui/client.py @@ -152,12 +152,12 @@ class DelugeRPCProtocol(DelugeTransferProtocol): # Recreate exception and errback'it try: # The exception class is located in deluge.error - if hasattr(error, request[2]): + try: exception_cls = getattr(error, request[2]) exception = exception_cls(*request[3], **request[4]) - else: - # Shouldn't happen - raise Exception("Received invalid exception: %s", request[2]) + except TypeError, err: + log.warn("Received invalid RPC_ERROR (Old daemon?): %s", request[2]) + return # Ideally we would chain the deferreds instead of instance # checking just to log them. But, that would mean that any @@ -187,7 +187,6 @@ class DelugeRPCProtocol(DelugeTransferProtocol): # what's happening log.debug(msg) except: - # Failed probably because of invalid data (old daemon) import traceback log.error("Failed to handle RPC_ERROR (Old daemon?): %s\nLocal error: %s", request[2], traceback.format_exc()) d.errback(exception)