From db853c7c5694f3ea84c36b27638e18ab375adf99 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Mon, 16 Mar 2009 13:30:55 +0000 Subject: [PATCH] improve the export decorator slightly to allow for it to be used without being called. --- deluge/core/rpcserver.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deluge/core/rpcserver.py b/deluge/core/rpcserver.py index 063097755..410cd09ab 100644 --- a/deluge/core/rpcserver.py +++ b/deluge/core/rpcserver.py @@ -34,6 +34,7 @@ from twisted.internet.protocol import Factory, Protocol from twisted.internet import ssl, reactor from OpenSSL import crypto, SSL +from types import FunctionType import deluge.rencode as rencode from deluge.log import LOG as log @@ -60,7 +61,12 @@ def export(auth_level=AUTH_LEVEL_DEFAULT): func._rpcserver_auth_level = auth_level return func - return wrap + if type(auth_level) is FunctionType: + func = auth_level + auth_level = AUTH_LEVEL_DEFAULT + return wrap(func) + else: + return wrap class DelugeError(Exception): pass