On Tue, Sep 2, 2008 at 12:10 AM, kalin m <[EMAIL PROTECTED]> wrote:
>
> hi...
>
> following:
> http://www.turbogears.org/2.0/docs/main/Wiki20/wiki20.html
>
> section: Initializing the Tables
>
> i copied and using the initializeDB.py file.
> executing: python initializeDB.py
>
> (btw: somebody should mention there that in order to use the zope modules
> you'd have to do: source bin/activate in the new environment created for tg2
> . otherwise python can't find those)...
>
well given that the tutorial itself doesn't suggest (but it should) a
virtualenv, I don't see why this is relevant. if you are in a virtual
env you should always activate it. the only reason it's failing on
"zope" is because that's the first one it doesn't finds.
> 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...
>
The new transactions stuff was commit some days ago and the example
hasn't been reviewed, I'm really not familiar with the code so I'll
let someone else comment on how to fix it properly.
> then the devdata.db looks weired... not like a sql table for sure.. and i
> bet nothing is stored. because if i proceed and do the page.html etc. i get:
> NoResultFound: No row was found for one()
>
huh? yes it's a sqlite file, it's not plain text.
if you want to see if the table was created you need to run
$ sqlite3 devdata.db
SQLite version 3.4.2
Enter ".help" for instructions
sqlite> .schema
---- you should see the table definition here ------
>
> well... thanks....
>
>
> here is the problem:
>
> $ python initializeDB.py
> 2008-09-02 02:03:24,054 INFO sqlalchemy.engine.base.Engine.0x..30 PRAGMA
> table_info("pages")
> 2008-09-02 02:03:24,054 INFO sqlalchemy.engine.base.Engine.0x..30 {}
> 2008-09-02 02:03:24,055 INFO sqlalchemy.engine.base.Engine.0x..30
> DROP TABLE pages
> 2008-09-02 02:03:24,055 INFO sqlalchemy.engine.base.Engine.0x..30 {}
> 2008-09-02 02:03:24,058 INFO sqlalchemy.engine.base.Engine.0x..30 COMMIT
> 2008-09-02 02:03:24,060 INFO sqlalchemy.engine.base.Engine.0x..30 PRAGMA
> table_info("pages")
> 2008-09-02 02:03:24,061 INFO sqlalchemy.engine.base.Engine.0x..30 {}
> 2008-09-02 02:03:24,062 INFO sqlalchemy.engine.base.Engine.0x..30
> CREATE TABLE pages (
> id INTEGER NOT NULL,
> pagename TEXT,
> data TEXT,
> PRIMARY KEY (id),
> UNIQUE (pagename)
> )
>
>
> 2008-09-02 02:03:24,063 INFO sqlalchemy.engine.base.Engine.0x..30 {}
> 2008-09-02 02:03:24,066 INFO sqlalchemy.engine.base.Engine.0x..30 COMMIT
> Traceback (most recent call last):
> File "initializeDB.py", line 19, in <module>
> DBSession.commit()
> File
> "/path/tg2env/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta3-py2.5.egg/sqlalchemy/orm/scoping.py",
> line 106, in do
> return getattr(self.registry(), name)(*args, **kwargs)
> File
> "/path/tg2env/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta3-py2.5.egg/sqlalchemy/orm/session.py",
> line 663, in commit
> self.transaction.commit()
> File
> "/path/tg2env/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta3-py2.5.egg/sqlalchemy/orm/session.py",
> line 376, in commit
> self._prepare_impl()
> File
> "/path/tg2env/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta3-py2.5.egg/sqlalchemy/orm/session.py",
> line 352, in _prepare_impl
> self.session.extension.before_commit(self.session)
> File
> "/path/tg2env/lib/python2.5/site-packages/zope.sqlalchemy-0.3-py2.5.egg/zope/sqlalchemy/datamanager.py",
> line 191, in before_commit
> assert zope_transaction.get().status == 'Committing', "Transaction must
> be committed by zope"
> AssertionError: Transaction must be committed by zope
>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---