mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +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,
|
||||
'reset': None,
|
||||
'__call__': None,
|
||||
'__lt__': lambda self: 0,
|
||||
'inFilter': lambda self, irc, msg: msg,
|
||||
'outFilter': lambda self, irc, msg: msg,
|
||||
'name': lambda self: self.__class__.__name__,
|
||||
|
@ -330,13 +330,11 @@ def firewall(f, errorHandler=None):
|
||||
|
||||
class MetaFirewall(type):
|
||||
def __new__(cls, name, bases, dict):
|
||||
firewalled = {}
|
||||
if '__firewalled__' in dict:
|
||||
firewalled.update(dict['__firewalled__'])
|
||||
for attr in firewalled:
|
||||
for attr in dict['__firewalled__']:
|
||||
try:
|
||||
errorHandler = firewalled[attr]
|
||||
except:
|
||||
except: # This is raw here so people can still use tuples.
|
||||
errorHandler = None
|
||||
dict[attr] = firewall(dict[attr], errorHandler)
|
||||
return super(MetaFirewall, cls).__new__(cls, name, bases, dict)
|
||||
|
@ -31,6 +31,7 @@ class Object(object):
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
|
||||
class TupleSubclass(type):
|
||||
def __new__(cls, name, bases, dict):
|
||||
assert tuple in bases
|
||||
|
Loading…
Reference in New Issue
Block a user