diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-05-29 18:49:27 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-05-29 18:49:27 -0400 |
| commit | 3bf77b1b0b18b6091c96e37823bcca87237d5482 (patch) | |
| tree | 7ce0a8733694d2ebf6e696dcca68d22fad8bd62b /lib/sqlalchemy/event.py | |
| parent | 9c746c44a314d357b855108b6e99b773ce52f760 (diff) | |
| parent | be2c145a84df5db0233f84995765d3f614776f75 (diff) | |
| download | sqlalchemy-3bf77b1b0b18b6091c96e37823bcca87237d5482.tar.gz | |
Merge branch 'rel_0_9'
Conflicts:
lib/sqlalchemy/dialects/postgresql/hstore.py
lib/sqlalchemy/util/__init__.py
lib/sqlalchemy/util/compat.py
Diffstat (limited to 'lib/sqlalchemy/event.py')
| -rw-r--r-- | lib/sqlalchemy/event.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/sqlalchemy/event.py b/lib/sqlalchemy/event.py index f28f19ee9..d8c44dd05 100644 --- a/lib/sqlalchemy/event.py +++ b/lib/sqlalchemy/event.py @@ -171,7 +171,8 @@ class _EventMeta(type): associated _Dispatch classes.""" def __init__(cls, classname, bases, dict_): - _create_dispatcher_class(cls, classname, bases, dict_) + if classname != 'MetaBase': + _create_dispatcher_class(cls, classname, bases, dict_) return type.__init__(cls, classname, bases, dict_) @@ -200,12 +201,9 @@ def _remove_dispatcher(cls): if not _registrars[k]: del _registrars[k] - -class Events(object): +class Events(util.with_metaclass(_EventMeta, object)): """Define event listening functions for a particular target type.""" - __metaclass__ = _EventMeta - @classmethod def _accept_with(cls, target): # Mapper, ClassManager, Session override this to @@ -377,9 +375,11 @@ class _EmptyListener(object): def __iter__(self): return iter(self.parent_listeners) - def __nonzero__(self): + def __bool__(self): return bool(self.parent_listeners) + __nonzero__ = __bool__ + class _CompoundListener(object): _exec_once = False @@ -414,9 +414,10 @@ class _CompoundListener(object): def __iter__(self): return chain(self.parent_listeners, self.listeners) - def __nonzero__(self): + def __bool__(self): return bool(self.listeners or self.parent_listeners) + __nonzero__ = __bool__ class _ListenerCollection(_CompoundListener): """Instance-level attributes on instances of :class:`._Dispatch`. |
