EXT_STOP in MapperExtension not working as expected

Issue #1548 resolved
Former user created an issue

I started by implementing custom MapperExtension that checks whether there is already a column with identical value in the table. In before_insert(), I check for existing values and when these are found, I just use return EXT_STOP. But the object still makes it's way to database :S

From the documentation I can read out that it shouldn't make into the database...

Anyway, if this is not the case, it would be nice to have EXT_ABORT (or similar feature...)

Comments (2)

  1. Mike Bayer repo owner

    EXT_STOP discontinues further extensions from processing. It doesn't stop the actual operation.

    If you want to change the flush plan before it goes in, use SessionExtension.before_flush() instead - at that point you'd want to expire() (or expunge()) the object which you don't want inserted.

  2. Log in to comment