Fix bug introduced in 19234d

This commit is contained in:
bendikro 2013-05-27 23:15:09 +02:00
parent 19234d6565
commit d91a9504aa
2 changed files with 10 additions and 7 deletions

View File

@ -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]:

View File

@ -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)