> My problem is, I have a save procedure with update command.
> the tg log said it is correct UPDATE sql command with commit command.
> but when I look on my database, the record is gone, looks like this
> record has been delete.
>
> I dont know why its happen.
> I'm using postgresql 8.3 and tg2.
>
> Here are parts of my code.
> =============================================
>
> The Header :
>
> """Currencies Controller"""
> #from administrator.lib.base import Controller
> from administrator.lib.base import BaseController
> from tg import expose, redirect, flash
> from pylons.i18n import ugettext as _
> from turbojson.jsonify import jsonify, encode as json_encode
> from administrator.model import DBSession, metadata
> from administrator.model.currencies import Currencies
> import transaction
>
>
> The class :
>
> class CurrenciesController(BaseController):
>     #similar with index.htm
>     @expose('administrator.templates.currencies.index')
>     def currencies(self):
>         currencies_rs = DBSession.query(Currencies)
>         return dict(title='Currencies', currencies_view=currencies_rs)
>
>     def save(self, currency_id, currency_name, currency_symbol,
> currency_status):
>         currency = DBSession.query(Currencies).filter_by(currency_id =
> currency_id).one()
>         currency.name = currency_name
>         currency.symbol = currency_symbol
>         currency.status = currency_status

I'm not very familiar with sqlalchemy so it's entirely possible that
I'm wrong, but don't you have to add your objects to the session
explicitly?

http://www.sqlalchemy.org/docs/05/ormtutorial.html

HTH,
Daniel


-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown

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