[sqlalchemy] Re: Extension Mapper

2008-08-30 Thread GustaV
It almost works. A small problem though : when I get and modify instances (a priori not loaded before the flush) in after_flush method, they are correctly added in the dirty list of the session but the 2nd flush does nothing. This is because the identity_map is still flagged as 'not modified' On

[sqlalchemy] Re: Extension Mapper

2008-08-30 Thread Michael Bayer
use before_flush() for changes to the dirty list and suchor if you really want things set up for the *next* flush, use after_flush_postexec(). On Aug 30, 2008, at 10:08 AM, GustaV wrote: It almost works. A small problem though : when I get and modify instances (a priori not loaded

[sqlalchemy] Re: Extension Mapper

2008-08-30 Thread GustaV
I planned to do it on the next flush as you said, but since it is not very clean, I manage to do it in the before_flush method. So, last message on that subject I think: Since 'dirty' var is set before the call of 'before_flush' ( dirty = self._dirty_states ); it doesn't take modification that

[sqlalchemy] Re: Extension Mapper

2008-08-30 Thread Michael Bayer
On Aug 30, 2008, at 1:55 PM, GustaV wrote: I planned to do it on the next flush as you said, but since it is not very clean, I manage to do it in the before_flush method. So, last message on that subject I think: Since 'dirty' var is set before the call of 'before_flush' ( dirty =

[sqlalchemy] Re: Extension Mapper

2008-08-29 Thread GustaV
You must be right. Of course, Turbogears2 already add an extension to the session, and it looks like it is not a list of extension anyway (or maybe in the latest trunk?). What the best way then? To subclass the tg2 extension with mine and continue to call overloaded method from mine? Anything

[sqlalchemy] Re: Extension Mapper

2008-08-29 Thread Michael Bayer
On Aug 29, 2008, at 11:36 AM, GustaV wrote: You must be right. Of course, Turbogears2 already add an extension to the session, and it looks like it is not a list of extension anyway (or maybe in the latest trunk?). What the best way then? To subclass the tg2 extension with mine and

[sqlalchemy] Re: Extension Mapper

2008-08-29 Thread Michael Bayer
in r5069, extension can be a list of SessionExtension objects. You can also append to session.extensions. On Aug 29, 2008, at 11:36 AM, GustaV wrote: You must be right. Of course, Turbogears2 already add an extension to the session, and it looks like it is not a list of extension

[sqlalchemy] Re: Extension Mapper

2008-08-28 Thread Michael Bayer
On Aug 28, 2008, at 6:57 PM, GustaV wrote: Hi all. I'm currently working on a map (like in geography :) ) When a new tile in inserted in the DB, I'm using an extension mapper to update some neighbor's properties (like the neighbors count). The after_insert method helps a lot... but: