On Tuesday 08 November 2005 05:38, Andreas Elvers wrote:
> Hi,
> sorry for asking it here but sqlos mailing list seems dead.
> Has anyone yet tried sqlos with database connections created as local
> utilities ? At one point sqlos tries to get the utility in connection.py
> Line 88.
>   newconn = zapi.queryUtility(IZopeDatabaseAdapter, name,
>                                                      default=None,
>                                                      context=context)
> The context points to a sqlobject instance. The problem is that these
> instances seem to have no parent and thus will fail the lookup my local
> utility and will raise an 'NoneType' object is not callable error later
> in the code when trying to adapt.
> When you try the sqlos example everything is fine, since the database
> connection is defined in configure.zcml as a global utility.
> My current idea is to expose the enclosing folder as a context to query
> utility. But I don't know if setting references in sqlobject instances
> is such a great idea.

If the sqlobject instance does not have a parent, then that's bad. It probably 
does not have a parent, because it is usually wrapped using a location proxy, 
which is lost inside a method. I think the smart thing to do here would be 
what you suggested or to write a subclass of sqlobject that implements 

Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
Zope3-users mailing list

Reply via email to