[Z3-sqlos] sqlos and per site databases
Brian Sutherland
jinty at web.de
Tue Jan 24 10:35:04 CET 2006
On Mon, Dec 12, 2005 at 12:00:22PM +0100, Andreas Elvers wrote:
> Hi Brian,
>
> thanks for your reply. I will check out your proposed changes, but since
> we dropped sqlos, i have to create a new demo which should be not
> too much work. There should be some time later this week.
I thought you might like to know that I have fixed and enabled your
functional test. It passes now.
Enjoy:)
>
> - Andreas
>
> On 09.12.2005, at 15:41, Brian Sutherland wrote:
>
> > On Tue, Nov 01, 2005 at 01:51:29PM +0100, Andreas Elvers wrote:
> >> Hi,
> >>
> >> I am having problems with sqlos and local utilities. I have a folder
> >> which is a site. This site has a local utility which is a psycopg
> >> adapter named as 'psycopg'. I have registered this name with
> >> sqlos. When
> >> adding a SQLObjectContainer to this site folder my guess is, that
> >> this
> >> container should use the db adapter 'psycopg'.
> >>
> >> While adding I get a "'NoneType' object is not callable" in
> >> connection.py on line 96. This is because queryUtility really does
> >> not
> >> find my local Utility although context point to the newly created
> >> SQLObjectContainer and the utility name is currect either.
> >
> > Hi Andreas,
> >
> > I found you test for the issue in the issue tracker and committed
> > it to
> > the trunk. Though it is disabled until the issue is fixed.
> >
> > I can see at least two problems:
> >
> > * Sometimes the connection descriptor does not have the right context
> > when querying the utilities. We could probably fix that on a case by
> > case basis by getting the connection before the sqlobject call with
> > the right context.
> >
> > Here is a sci-fi replacement of the container items() method:
> >
> > def items(self):
> > """Return a sequence-like object containing tuples of the form
> > (name, object) for the objects that appear in the folder.
> > """
> > # we need to get the connection ourselves to avoid breaking
> > # local
> > # utilities that set the connection
> > ut = zapi.getUtility(IConnectionName, context=self)
> > connection = getConnection(self, ut.name)
> > # iterate through the factories returning all the results
> > for factoryName in self.allowedFactories():
> > factory = zapi.getUtility(IISQLObject, factoryName,
> > context=self)
> > for obj in factory.select(connection=connection):
> > name = '%s.%s' % (factoryName, obj.id)
> > yield (name, contained(obj, parent=self, name=name))
> >
> > * The connection cache into sqlos.connection only can cope with one
> > connection name per thread. This will seriously break if you do
> > something like having two local connections with the same name.
> >
> > Unfortunately, I don't have the time to fix these now...
> >
> > --
> > Brian Sutherland
> >
> > Metropolis - "it's the first movie with a robot. And she's a woman.
> > And she's EVIL!!"
> >
>
> o------------------------------------------------- - -
> | Andreas Elvers // andreas at work.de
> | n at work Internet Informationssyteme GmbH
> | T: +49 40 23 88 09 0 // F: +49 40 23 88 09 29
> o--------------------------------------------------------------- - -
>
--
Brian Sutherland
Metropolis - "it's the first movie with a robot. And she's a woman.
And she's EVIL!!"
More information about the z3-sqlos
mailing list