Just to be able to reproduce it, what are your declaration parameters
and which DB/connector are you using ?

Have you see that by default SQLObject enable the autoCommit?

http://www.sqlobject.org/SQLObject.html#declaring-the-class



Jeff Watkins wrote:
> I'm not certain whether the problem I'm about to describe is in
> SQLObject or in TurboGears. So I've sent this email to both lists.
>
> I have the following model object:
>
>
> hub = PackageHub("cms")
> __connection__ = hub
>
> class Article(SQLObject,ModelHelper):
>      slug= StringCol( alternateID=True, length=255 )
>      sourceFile= StringCol( alternateID=True )
>      # more stuff
>
> I've created a single Article so far. When I load a fresh tg-admin
> shell, and attempt to create a new transaction to manipulate the
> article, the following happens:
>
>
> Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
> [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
>  >>> from cms.model import *
>  >>> a= Article.get(1)
>  >>> a._connection.transaction().begin()
> Traceback (most recent call last):
>    File "<console>", line 1, in ?
>    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> python2.4/site-packages/SQLObject-0.7.0-py2.4.egg/sqlobject/
> dbconnection.py", line 809, in begin
>      assert self._obsolete, "You cannot begin a new transaction
> session without rolling back this one"
> AssertionError: You cannot begin a new transaction session without
> rolling back this one
>
>
> You may well ask why I'm going through the weird hoops to get a
> transaction. The answer is I'm working on a generic function which
> needs to create a transaction when modifying a model object. The
> above is just an example of me trying to puzzle out how SQLObject works.
>
> Can anyone explain to me how a transaction was begun in the snippet
> above?
>
>
> --
> Jeff Watkins
> http://metrocat.org/
>
> 'I know about people who talk about suffering for the common good.
> It's never bloody them! When you hear a man shouting "Forward, brave
> comrades!" you'll see he's the one behind the bloody big rock and the
> one wearing the only really arrow-proof helmet!'
> -- Rincewind gives a speech on politics. (Terry Pratchett,
> Interesting Times)

Reply via email to