[SQLObject] SQLObject and Zope 2.7.3/2.8.0a1
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Anders B. O. <an...@br...> - 2004-11-26 07:53:42
|
Hi, I realize that this question may have been brought up before, but I haven't been able to find a good answer in the archives. I am trying to make a Zope product that uses SQLObject to talk to a MySQL database. In my main class (SimpleItem) I have a method called listPeople() which looks like this: def listPeople(self): """Return a list of people""" p = Backend.People.select(Backend.People.q.entity == 0) people = list() for person in list(p): people.append({"id": person.id, "name": person.name, "lived": person.lived}) return people It is called from a ZPT file to get a list of authors (it's a book database) that can be displayed. It works fine right after being added, but after refreshing the product or restarting the Zope server, I get this error whenever I try to view a page that calls that method: Error Type: AttributeError Error Value: 'NoneType' object has no attribute 'iterSelect' According to the errorlog the error occurs on the line where I do the for-loop, which means that the problem is the list(p) call. I am guessing that this is due to persistence or something like that. I thought it might be something related to cache, so I tried setting _cacheValues = False on the Backend.People class, but that didn't change anything. Can anybody help? Is it just 100% impossible to use SQLObject with Zope 2? I have tried this with both Zope 2.7.3 and 2.8.0a1 with the same results. -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ UL+++$ P++ L+++ E- W+ N(+) o K? w O-- M- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b++ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 |