[z3] trying sqlos trunk on Z3 trunk
Adam Groszer
adamg at fw.hu
Sat Nov 5 11:56:23 CET 2005
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?
--
Best regards,
Adam mailto:adamg at fw.hu
--
Quote of the day:
Every solution breeds new problems.
-------------- next part --------------
from zope.interface import implements
from sqlobject import *
from sqlos import SQLOS
from sot.interfaces import IPerson
from sqlos.container import SQLObjectContainer
from sot.interfaces import IPersonContainer
class Person(SQLOS):
implements(IPerson)
#_columns = [StringCol('username', length=20, notNull=True),
# StringCol('fname', length=20, notNull=True),
# StringCol('lname', length=20, notNull=True),]
username = StringCol('username', length=20, notNull=True)
fname = StringCol('fname', length=20, notNull=True)
lname = StringCol('lname', length=20, notNull=True)
class PersonContainer(SQLObjectContainer) :
implements(IPersonContainer)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: configure.zcml
Type: application/octet-stream
Size: 2655 bytes
Desc: not available
Url : http://codespeak.net/pipermail/z3/attachments/20051105/5638ca28/configure.obj
-------------- next part --------------
from zope.schema import TextLine
from zope.interface import Interface, Attribute
from zope.app.container.constraints import ItemTypePrecondition
from sqlos.interfaces.container import ISQLObjectContainer
class IPerson(Interface):
id = Attribute('Id')
username = TextLine(title=u'Username',
description=u'The name of the user')
fname = TextLine(title=u'Given Name',
description=u'The given name of the user')
lname = TextLine(title=u'Surname',
description=u'The surname of the user')
class IPersonContainer(ISQLObjectContainer) :
def __setitem__(name, item) :
pass
__setitem__.precondition = ItemTypePrecondition( IPerson )
More information about the z3
mailing list