diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-02-11 19:55:34 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-02-11 19:55:34 -0500 |
| commit | 4a79bc578c67297c707a00d8fafaba533e2833d9 (patch) | |
| tree | 808a412724a8137a95472ba974def1073ea1a301 /lib/sqlalchemy/ext/declarative/base.py | |
| parent | 0050a8d3db04767b97e48f3aa71381b786481231 (diff) | |
| download | sqlalchemy-4a79bc578c67297c707a00d8fafaba533e2833d9.tar.gz | |
- Fixed bug where :class:`.AbstractConcreteBase` would fail to be
fully usable within declarative relationship configuration, as its
string classname would not be available in the registry of classnames
at mapper configuration time. The class now explicitly adds itself
to the class regsitry, and additionally both :class:`.AbstractConcreteBase`
as well as :class:`.ConcreteBase` set themselves up *before* mappers
are configured within the :func:`.configure_mappers` setup, using
the new :meth:`.MapperEvents.before_configured` event. [ticket:2950]
- Added new :meth:`.MapperEvents.before_configured` event which allows
an event at the start of :func:`.configure_mappers`, as well
as ``__declare_first__()`` hook within declarative to complement
``__declare_last__()``.
- modified how after_configured is invoked; we just make a dispatch()
not actually connected to any mapper. this makes it easier
to also invoke before_configured correctly.
- improved the ComparableEntity fixture to handle collections that are sets.
Diffstat (limited to 'lib/sqlalchemy/ext/declarative/base.py')
| -rw-r--r-- | lib/sqlalchemy/ext/declarative/base.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sqlalchemy/ext/declarative/base.py b/lib/sqlalchemy/ext/declarative/base.py index 4fda9c734..eb66f12b6 100644 --- a/lib/sqlalchemy/ext/declarative/base.py +++ b/lib/sqlalchemy/ext/declarative/base.py @@ -52,6 +52,10 @@ def _as_declarative(cls, classname, dict_): @event.listens_for(mapper, "after_configured") def go(): cls.__declare_last__() + if '__declare_first__' in base.__dict__: + @event.listens_for(mapper, "before_configured") + def go(): + cls.__declare_first__() if '__abstract__' in base.__dict__: if (base is cls or (base in cls.__bases__ and not _is_declarative_inherits) |
