I found the problem: it is with the instrumentation_finders stuff you
helped us with months ago (see below). The problem can be reproduced
with this:
class DummyMapperExtension(MapperExtension):
pass
mapper(ModelPresentValue, model_present_value,
extension=DummyMapperExtension())
If the instrumentation hook is put in and you use a mapper extension
(even a dummy one) then the session update code stops working.
instrumentation + mapper_extension => fail
instrumentation only => works
mapper_extension only => works
I tried debugging the instrumentation_find stuff before but didn't
make much progress. I will open up a ticket on trac (if there isn't
one there already)
pjjH
# Set docstrings of attributes to the empty string, in order to avoid
# ugly-looking stuff that would otherwise appear as default.
class AttachNotesAsDocstring(interfaces.InstrumentationManager):
def instrument_attribute(self, class_, key, attr):
if isinstance(attr.property, properties.ColumnProperty):
if hasattr(attr.property.columns[0], 'info'):
attr.__doc__ = attr.property.columns[0].info.get
('notes')
else:
attr.__doc__ = ''
# We get a weird error from SQLAlchemy when we have customized
# instrumentation and try to cog a file:
#
# AttributeError: 'ColumnProperty' object has no attribute
'strategy'
#
# As a workaround, we do not attempt to do any fancy instrumentation
# if the cog module has been imported.
if not 'cog' in sys.modules:
sqlalchemy.orm.attributes.instrumentation_finders.append(
lambda cls: AttachNotesAsDocstring)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---