The update and commit should be automatic (assuming no exceptions), I
rely on this behaviour all the time.

I just tested your controller method in a fresh quickstarted project
and the update worked fine.

It might be how you are defining your model.  Are you using
assign_mapper ?

This is the model I used to test your case (imports excluded):

-----
from sqlalchemy import *
from turbogears.database import metadata, session
from sqlalchemy.ext.assignmapper import assign_mapper

mydata_table = Table('mydata', metadata,
    Column('id', Integer, primary_key=True),
    Column('value', String(256))
)

class MyData(object):
    def get(self, id):
        return MyData.get_by(id=id)
    get = classmethod(get)

assign_mapper(session.context, MyData, mydata_table)
-----

How does that compare with yours?

Cheers,
Chris


On Apr 24, 4:53 pm, remi jolin <[EMAIL PROTECTED]> wrote:
>     @expose('json', allow_json=True)
>     def store_info(self, id, info):
>        d = MyData.get(id)
>         if not d:
>             return dict(state="Nok")
>         v = d.value
>         d.value=info
>         return dict(state="OK", prev_value=v)
>
> If I do http://xxxx:8080/store_info/1/new_data, I get back the json dict
> but the data is not updated (if I enable the DB engine echo, I can see
> the commit but no update). Is it the normal behavior ?
> It is only updated if I force a flush (session.flush()) before the return.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to