On a page, I have the following code (simplified):
@turbogears.expose(format="json")
def subcategory(self, category_id):
try:
#return subcategories in the selected category via JSON
#subcategories = SubCategory.selectBy(categoryID=int(category_id))
subcategories = SubCategory.select(SubCategory.q.categoryID ==
category_id)
except SQLObjectNotFound:
raise cherrypy.NotFound
return dict(subcategories=subcategories)
In the code above, I have 2 lines which, in my mind, should be
identical, one with selectBy and the other with select. However, when
I access /subcategory/4?tg_format=json, the select line works perfectly
(i.e. prints out the results) while selectBy line gives the following
error:
File
"/usr/lib/python2.4/site-packages/SQLObject-0.7.2-py2.4.egg/sqlobject/dbconnection.py",
line 749, in assertActive
assert not self._obsolete, "This transaction has already gone through
ROLLBACK; begin another transaction"
AssertionError: This transaction has already gone through ROLLBACK;
begin another transaction
Does anyone know why this is? I'm almost certain that these two lines
ran the same way before I moved the server to Ubuntu and upgraded to
TG1.0 (from TG1.0b2).
Frank
I don't know if TG 1.0.1 fixes this or not, but I know I had the
problem in TG 1.0