On Friday 07 September 2007 20:25:50 Michael Bayer wrote: > we've got plenty of MapperExtensions running. i dont see how you > are getting mapper.extension to be your actual mapper, its supposed > to point to a container called ExtensionCarrier ( > unless, you are > saying mapper.extension = _MapExt(). > not supported, unless you > want to provide a property-based patch for it). yes, i am setting it this way... okay, if thats not the proper way anymore, i'll have a look. Any other way to force a readonly mapper? its for mapping of (virtual) base classes that must not have instances.
> On Sep 7, 2007, at 11:12 AM, [EMAIL PROTECTED] wrote: > > or has something in MapperExt protocol changed? > > > > File "dbcook/usage/samanager.py", line 189, in > > query_BASE_instances return session.query( m.plain ) > > File "sqlalchemy/orm/session.py", line 638, in query > > q = self._query_cls(mapper_or_class, self, **kwargs) > > File "sqlalchemy/orm/query.py", line 31, in __init__ > > self._extension = self.mapper.extension.copy() > > AttributeError: '_MapExt' object has no attribute 'copy' > > > > i have very simple one, just for sanity checks: > > > > class _MapExt( sqlalchemy.orm.MapperExtension): > > def before_insert( self, mapper, connection, instance): > > assert (instance.__class__ is not mapper.class_, > > 'load_only_object - no save: ' > > + str( instance.__class__) + ':'+str(mapper) > > ) > > before_update = before_delete = before_insert > > > > _mapext = _MapExt() > > > > and using that one on all mappers which should be readonly. > > > > svilen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---