improve the export decorator slightly to allow for it to be used without
being called.
This commit is contained in:
parent
c0f11fbae4
commit
db853c7c56
|
@ -34,6 +34,7 @@ from twisted.internet.protocol import Factory, Protocol
|
||||||
from twisted.internet import ssl, reactor
|
from twisted.internet import ssl, reactor
|
||||||
|
|
||||||
from OpenSSL import crypto, SSL
|
from OpenSSL import crypto, SSL
|
||||||
|
from types import FunctionType
|
||||||
|
|
||||||
import deluge.rencode as rencode
|
import deluge.rencode as rencode
|
||||||
from deluge.log import LOG as log
|
from deluge.log import LOG as log
|
||||||
|
@ -60,6 +61,11 @@ def export(auth_level=AUTH_LEVEL_DEFAULT):
|
||||||
func._rpcserver_auth_level = auth_level
|
func._rpcserver_auth_level = auth_level
|
||||||
return func
|
return func
|
||||||
|
|
||||||
|
if type(auth_level) is FunctionType:
|
||||||
|
func = auth_level
|
||||||
|
auth_level = AUTH_LEVEL_DEFAULT
|
||||||
|
return wrap(func)
|
||||||
|
else:
|
||||||
return wrap
|
return wrap
|
||||||
|
|
||||||
class DelugeError(Exception):
|
class DelugeError(Exception):
|
||||||
|
|
Loading…
Reference in New Issue