[z3] trying sqlos trunk on Z3 trunk
Adam Groszer
adamg at fw.hu
Sat Nov 5 14:56:42 CET 2005
Hello Brian,
I added the adapter, now adding the container works.
But adding a new person fails with:
[snip]
Module zope.tales.expressions, line 204, in __call__
return self._eval(econtext)
Module zope.tales.expressions, line 198, in _eval
return ob()
Module zope.app.form.browser.add, line 62, in update
self.createAndAdd(data)
Module zope.app.form.browser.add, line 112, in createAndAdd
content = self.add(content)
Module zope.app.form.browser.add, line 135, in add
return self.context.add(content)
Module sqlos.container, line 178, in add
return container[name]
Module sqlos.container, line 117, in __getitem__
raise KeyError, name
KeyError: 'sot.Person.7'
The SQL (postgres) looks like this:
CREATE TABLE person
(
id oid NOT NULL,
username varchar(20) NOT NULL,
fname varchar(20) NOT NULL,
lname varchar(20) NOT NULL,
CONSTRAINT person_pkey PRIMARY KEY (id)
)
WITH OIDS;
ALTER TABLE person OWNER TO postgres;
Saturday, November 5, 2005, 12:44:19 PM, you wrote:
> On Sat, Nov 05, 2005 at 11:56:23AM +0100, Adam Groszer wrote:
>> I'm trying to get the readme.txt example working on the Z3 trunk.
>> The current files are attached.
>>
>> If I try to add a Person container to the Z3 root the following
>> exception comes:
>>
>> [snip]
>> Module zope.component.site, line 89, in subscribers
>> return self.adapters.subscribers(required, provided)
>> Module zope.interface.adapter, line 487, in subscribers
>> subscribers = [subscription(*objects)
>> Module zope.app.container.contained, line 175, in dispatchToSublocations
>> for sub in subs.sublocations():
>> Module zope.app.container.contained, line 206, in sublocations
>> for key in container:
>> Module sqlos.container, line 82, in keys
>> for name, obj in self.items(): yield name
>> Module sqlos.container, line 99, in items
>> for obj in factory.select():
>> Module sqlobject.sresults, line 149, in __iter__
>> return iter(list(self.lazyIter()))
>> Module sqlobject.sresults, line 156, in lazyIter
>> conn = self._getConnection()
>> Module sqlobject.sresults, line 38, in _getConnection
>> return self.ops.get('connection') or self.sourceClass._connection
>> Module sqlos.connection, line 47, in __get__
>> return getConnection(context, name)
>> Module sqlos.connection, line 95, in getConnection
>> conn = IZopeSQLConnection(newconn())
>> Module zope.interface.interface, line 676, in __call__
>> raise TypeError("Could not adapt", obj, self)
>> TypeError: ('Could not adapt', <zope.app.rdb.ZopeConnection
>> object at 0x03BA3F70>, <InterfaceClass
>> sqlos.interfaces.IZopeSQLConnection>)
>>
>> Am I doing something wrong?
> You hit one of the remaining warts in sqlos. You need to register an
> adapter from IZopeConnection to IZopeSQLConnection (For your database).
> Have a look in the ftesting.zcml of the current sqlos trunk for an
> example.
--
Best regards,
Adam mailto:adamg at fw.hu
--
Quote of the day:
If writers were bakers, this sentence would be exactly a dozen words long. - Douglas R Hofstadter
More information about the z3
mailing list