Hello Chris,
Chris Miles a écrit :
> The update and commit should be automatic (assuming no exceptions), I
> rely on this behaviour all the time.
>
That's what I did too... It works well in all the other methods.
> I just tested your controller method in a fresh quickstarted project
> and the update worked fine.
>
>
Before posting to the list, I also tried in a project started from scratch.
> It might be how you are defining your model. Are you using
> assign_mapper ?
>
No, I use activemapper and my model is :
from sqlalchemy import *
from sqlalchemy.ext.activemapper import ActiveMapper, column, \
one_to_many, one_to_one, many_to_many
from turbogears.database import metadata, session
import sqlalchemy.mods.selectresults
class MyData(ActiveMapper):
class mapping:
__table__ = 'my_data'
id = column(Integer, primary_key=True)
value = column(Unicode(16))
def __repr__(self):
return "<MyData id:%s, value:%s>" % (self.id, self.value)
> 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
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---