expiring the obj has the effect that any further access to the object will 
auto-refresh it. so if u expire(x) and then say x.a. x will be reloaded 
first then u get x.a

Utku Altinkaya wrote:
> 
> 
> On 16 Aralık, 17:46, [EMAIL PROTECTED] wrote:
>> the expire() is requesting a reload.
>> try moving that after the sending back stuff to user.
> 
> The documents says it does not reload until it is accessed if the
> object is expired, I think what does the thing you have mantioned is
> the refresh method of session.
> http://www.sqlalchemy.org/docs/04/session.html#unitofwork_using_refreshing
> 
>>
>>
>> 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- Alıntıyı gizle -
>> - Alıntıyı göster -
> 
> > 



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to