mirror of https://github.com/Mikaela/Limnoria.git
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__,
|
||||
|
|
14
src/log.py
14
src/log.py
|
@ -330,15 +330,13 @@ 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:
|
||||
try:
|
||||
errorHandler = firewalled[attr]
|
||||
except:
|
||||
errorHandler = None
|
||||
dict[attr] = firewall(dict[attr], errorHandler)
|
||||
for attr in dict['__firewalled__']:
|
||||
try:
|
||||
errorHandler = firewalled[attr]
|
||||
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)
|
||||
#return type.__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