[Zope] Z PyGreSQL problems with a python product

John Morton jwm@plain.co.nz
Thu, 6 Apr 2000 19:21:01 +1200 (NZST)


I'm working on a python product (under 2.1.4) that calls a ZSQL method
when it's added, to store most of it's properties in a database using
a ZPyGreSQL connection. It's add method looks like this:

def manage_addLink(self, id, url, title, description, owner, undo_size=5,
		   click_audits=0, status='active', REQUEST=None):
	"""Add a link to a folder."""
	link_id = 0
	ob = self._setObject(id, Link(id, link_id))
	url, title, description, undo_size, click_audits, status, dead = ob.clean_input(
		url, title, description, undo_size, click_audits, status, 0)

	# Fake the owner for now.
	user_id = 1
	res = ob.sql_add_link(
		url=url,
		title=title,
		description=description,
		owner=user_id,
		undo_size=undo_size,
		click_audits=click_audits
		)
	zLOG.LOG('addLink', 100, 'Inside manage_addLink' ,
		 'About to assign the link id.')
	ob.link_id = res[0][0]	

	if REQUEST is not None:
		return self.manage_main(self, REQUEST)

It also calls a ZSQL method in it's manage_afterAdd method to update
it's present location in the ZORD to the database. The problem is I
get this error message when I got to add a link:

exceptions.ValueError

  Sorry, a Zope error occurred.

  Traceback (innermost last):
    File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 214, in publish_module
    File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 179, in publish
    File /usr/lib/zope/lib/python/Zope/__init__.py, line 180, in zpublisher_exception_hook
    File /usr/lib/zope/lib/python/ZODB/Transaction.py, line 180, in begin
    File /usr/lib/zope/lib/python/ZODB/Transaction.py, line 155, in abort
    File /usr/lib/zope/lib/python/Shared/DC/ZRDB/THUNK.py, line 115, in abort
    File /usr/lib/zope/lib/python/Products/ZPyGreSQLDA/db.py, line 117, in _abort
  ValueError: PQsendQuery() -- There is no connection to the backend.

And from that point on, until I close and open the database
connection, I get this message when testing any ZSQL method that uses
the same connection. 

Any idea as to what's going on?

John.