On 12/08/2009, at 1:59 AM, grassoalvaro wrote:
> > Hi, > > example from Pylons application: > > class DBAccountExtension(orm.interfaces.MapperExtension): > def after_insert(self, mapper, connection, instance): > response = hrd.user_create(instance.to_hrd()) > if response['status'] == hrd.STATUS_OK: > instance.csa = response['resdata']['user']['id'] > db.save_or_update(instance) > db.commit() > return orm.interfaces.EXT_CONTINUE > > After saving model i'm making request to some API (to save data there > also). API return status information (response['resdata']['user'] > ['id']) which i want to update in database so i'm trying to do > db.save_or_update(instance) and then db.commit() but after this 2 > lines application prints exception: > > InvalidRequestError: Instance '<DBAccount at 0x134360d0>' is not > persisted > > Any solutions? Not sure, I've never used MapperExtension. You might want to ask the SQLAlchemy list. Just make sure you tell them how "db" is defined. Cheers Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
