bojanb wrote:
>
> I was under the impression that returning EXT_STOP in my
> MapperExtension.before_insert() can prevent an object from being
> inserted into the database altogether, but that doesn't seem to be
> working, so I'm not sure if I'm misunderstanding the operation of
> MapperExtensions or it's a bug.

it does not.

http://www.sqlalchemy.org/docs/05/reference/orm/interfaces.html?highlight=mapperextension#sqlalchemy.orm.interfaces.MapperExtension

"Returning EXT_STOP will halt processing of further extensions handling
that method."

that only refers to additional extensions.


>
> I'd like to have objects with (non-mapped) attribute "temporary" set
> to True not be written to the database, because they haven't been
> fully initialized yet (e.g. some of their fields would violate
> integrity constraints).
>
> And before you say "simply don't add them to the session until they
> have been initialized" - they get added automatically because of
> backrefs.

turn off cascade on those backrefs:

'foo':relation(Bar, backref=backref('foos', cascade=None))



--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to