On Sep 2, 5:24 am, "Mark Ramm" <[EMAIL PROTECTED]> wrote:
> > if i don;t change anything in that file the last command: DBSession.commit()
> > raises an error - short version: AssertionError: Transaction must be
> > committed by zope. the long version is bellow...  if i comment that last
> > line it works fine and apparently does commit the table...  it doesn't bring
> > up any errors...
>
> Yea, transactions are committed automatically by the framework now, so
> there's no need to do it in the controller code anymore.
>
> Just removing DBSession.commit() wherever you see it should be enough
> to get you going.
>
> --Mark Ramm

Actually, these instructions don't quite work.  At least, they don't
cause anything to be committed.  Here's what I did to get it working:

1.  First, use the paster setup-app command to setup the database.
Using development.ini, the full command would be paster setup-app
development.ini.  This also has the benefit of running websetup.py,
and if you have users enabled for this Turbogears 2.0 project, some
default users and groups will be added into the database.  You may
also note that websetup.py has a transaction.commit() line--we'll be
using that later.
2.  Modify initializeDB.py as follows:
-- Comment out or delete the drop_all and create_all lines.  You don't
need to do that anymore since paster setup-app did all this for you,
plus more.
-- Comment out DBSession.commit() (as previously stated)
-- After DBSession.save(), add the following two lines:
DBSession.flush()
transaction.commit()
3.  Also, make sure to import transaction at the top of the file

That should cause the FrontPage page entry to be committed to the
database.

Aaron Levinson

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