the expire() is requesting a reload. try moving that after the sending back stuff to user.
Utku Altinkaya wrote: > Hi, > > I am using SQLAlchemy on a web application, I have used a base class > for ORM clases which provides soem web related things like validation > and loading data from forms etc. When the form is submitted: > Here is the current life cycle: > > object.loadFromForm() > if object.Validate(): > session.save_or_update(object) > else > render_form(object) > session.expire(object) > session.commit() > > I do not want to lose invalid values, becouse I want to send them to > the user again, so while using object as intermediate holder I have to > set attributes invalid values... So "Autoflush = False", and if > invalid values are existed the object is reloaded from DB before > commit step of web request cycle. > > But while using SQLAlchemy I had the impression that it is not > designed to to that, It designers thought objects are direct > representation of the data in the database. I can do this ofcouse > some kind of holder class copies attributes from data objects etc, but > it is cumbersome, and will force me to write longer code. > > I am expecting someone to tell me the way I am doing is perfectly > valid, or another advice > > regards > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---