On 9/24/15 2:06 PM, Chris Withers wrote:
Hi All,
I have a mixin class here that I've factored out of one project as I
want to use it in another one:
https://github.com/Mortar/mortar_mixins/blob/master/mortar_mixins/temporal.py
The problem is that importing the module seems to result in the
following exception being raised:
>>> from mortar_mixins.temporal import Temporal
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "mortar_mixins/temporal.py", line 81, in <module>
listen(Temporal, 'instrument_class', add_constraints, propagate=True)
File
"/Users/chris/vcs/git/mortar_mixins/lib/python2.7/site-packages/sqlalchemy/event/api.py",
line 89, in listen
_event_key(target, identifier, fn).listen(*args, **kw)
File
"/Users/chris/vcs/git/mortar_mixins/lib/python2.7/site-packages/sqlalchemy/event/api.py",
line 28, in _event_key
(identifier, target))
sqlalchemy.exc.InvalidRequestError: No such event 'instrument_class'
for target '<class 'mortar_mixins.temporal.Temporal'>'
you need to make sure SQLAlchemy ORM is at least imported when that
event handler is called and also you'd need to make sure propagate=True
is on it because it's only a mixin.
My guess is something to do with it not being mixed into any classes
at that point.
Weirdly, it seems to work fine, and all the tests run and pass,
although the nose run will spew the above error in addition to running
the tests.
To reproduce, just follow the instructions here:
<https://github.com/Mortar/mortar_mixins/blob/master/README.rst#development>https://github.com/Mortar/mortar_mixins/blob/master/README.rst#development
Any ideas what I should do to resolve this?
cheers,
Chris
--
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to sqlalchemy+unsubscr...@googlegroups.com
<mailto:sqlalchemy+unsubscr...@googlegroups.com>.
To post to this group, send email to sqlalchemy@googlegroups.com
<mailto:sqlalchemy@googlegroups.com>.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.