On Monday 27 November 2006 19:47, Oleg Broytmann wrote: > On Mon, Nov 27, 2006 at 07:04:33PM +0100, Diez B. Roggisch wrote: > > class User(SQLObjec): > > ... > > > > def _init(self, *args, **kwargs): > > if <the_table_row_is_created>: > > co_object = CoObject(userID=self.id) > > return super(User, self)._init(*args, **kwargs) > > > > This will ensure there is a CoObject whenever there is a User. > > _init() is called during creation, so you can be sure the row has not > been inserted into the DB yet, and there is no is. You need to change the > order of operations:
Maybe that then was the trouble for me, thank you! > def _init(self, *args, **kwargs): > super(User, self)._init(*args, **kwargs) # Perform INSERT and > get the id co_object = CoObject(userID=self.id) > > _init() really is the best method to override for INSERT, but there is > no single method to override for UPDATEs... Fine for me, I can do whatever is needed there using properties anyway. Thanks for your quick help, -- >> Diez B. Roggisch >> Developer T +49 (30) 443 50 99 - 27 F +49 (30) 443 50 99 - 99 M +49 (179) 11 75 303 E [EMAIL PROTECTED] >> artnology GmbH A Milastraße 4 / D-10437 Berlin T +49 (30) 443 50 99 - 0 F +49 (30) 443 50 99 - 99 E [EMAIL PROTECTED] I http://www.artnology.com ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ sqlobject-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
