>
> I wish to look for a certain object in the database at Turbogears
> startup and if it is not present create it: essentially a
> Foo.select(..) followed by a Foo(...) and a syncUpdate() if the select
> doesn't find it. I invoke this using the call_on_startup hook.
>
> If the appropriate Foo object is in the database all works well. If not
> the Foo() constructor is called as is the sync with no (apparent)
> problems but the DB entry is not created.
>
> If I drop the code in a controller and tickle it via a URL it works
> fine and the DB record is created so it is not the code per se.
>
> Is this subtle bug or have I been felled by newbyitis ??

Just a guess: Are you committing the transaction and flushing the session
after changing the DB?

This is automatically done by a CherryPy filter when manipulating the DB
inside a controller method but not when doing it outside, like in a
startup hook.

Alberto


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

Reply via email to