mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +01:00
Some more slight tweaks to the MetaFirewall implementation and stuff.
This commit is contained in:
parent
2861b5a334
commit
1d357dd470
@ -72,7 +72,6 @@ class IrcCallback(IrcCommandDispatcher):
|
|||||||
__firewalled__ = {'die': None,
|
__firewalled__ = {'die': None,
|
||||||
'reset': None,
|
'reset': None,
|
||||||
'__call__': None,
|
'__call__': None,
|
||||||
'__lt__': lambda self: 0,
|
|
||||||
'inFilter': lambda self, irc, msg: msg,
|
'inFilter': lambda self, irc, msg: msg,
|
||||||
'outFilter': lambda self, irc, msg: msg,
|
'outFilter': lambda self, irc, msg: msg,
|
||||||
'name': lambda self: self.__class__.__name__,
|
'name': lambda self: self.__class__.__name__,
|
||||||
|
@ -330,13 +330,11 @@ def firewall(f, errorHandler=None):
|
|||||||
|
|
||||||
class MetaFirewall(type):
|
class MetaFirewall(type):
|
||||||
def __new__(cls, name, bases, dict):
|
def __new__(cls, name, bases, dict):
|
||||||
firewalled = {}
|
|
||||||
if '__firewalled__' in dict:
|
if '__firewalled__' in dict:
|
||||||
firewalled.update(dict['__firewalled__'])
|
for attr in dict['__firewalled__']:
|
||||||
for attr in firewalled:
|
|
||||||
try:
|
try:
|
||||||
errorHandler = firewalled[attr]
|
errorHandler = firewalled[attr]
|
||||||
except:
|
except: # This is raw here so people can still use tuples.
|
||||||
errorHandler = None
|
errorHandler = None
|
||||||
dict[attr] = firewall(dict[attr], errorHandler)
|
dict[attr] = firewall(dict[attr], errorHandler)
|
||||||
return super(MetaFirewall, cls).__new__(cls, name, bases, dict)
|
return super(MetaFirewall, cls).__new__(cls, name, bases, dict)
|
||||||
|
@ -31,6 +31,7 @@ class Object(object):
|
|||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
return not self == other
|
return not self == other
|
||||||
|
|
||||||
|
|
||||||
class TupleSubclass(type):
|
class TupleSubclass(type):
|
||||||
def __new__(cls, name, bases, dict):
|
def __new__(cls, name, bases, dict):
|
||||||
assert tuple in bases
|
assert tuple in bases
|
||||||
|
Loading…
Reference in New Issue
Block a user