[Z3-sqlos] Error adapting connection
Ben Godfrey
ben at cohack.com
Wed Apr 13 05:20:55 CEST 2005
Hi,
I'm trying to get sqlos running, just from the tutorial really, but I'm
getting this error:
TypeError: ('Could not adapt', <zope.app.rdb.ZopeConnection object at
0x46d5df0>, <InterfaceClass sqlos.interfaces.IZopeSQLConnection>)
I have Zope X3 checked out of SVN yesterday. My SQLObject is 0.6.1. My
sqlos is also SVN. I'm using mysqldbda, which is also latest SVN.
Please see below for the configure.zcml for my (test) package and I've
attached a full traceback from transcript.log.
Also, I do get a little debug dump in transcript.log:
************************************************************************
******
{'username': u'root', 'parameters': {}, 'port': '', 'host':
u'localhost', 'password': 'XXX', 'dbname': u'photodb'}
************************************************************************
******
In addition, I have a couple of questions:
How can I use connections created through the site management folder
instead of hard-coded into ZCML?
Secondly, I'm interested in the possibility of building on top of sqlos
to make using SQLObjects one step more generic, i.e. creating SQLObject
classes from databases which in turn create interfaces which is all
patched together somehow with ZCML. The goal being that if you provide
a connection to a database you magically get a whole new set of
containers and types to add based on the structure of that database.
This is just a crazy idea really. I'm very green with Zope 3, and in
fact Zope full stop. I have no idea whether it's possible but it seems
an interesting idea, if fraught with danger :-)
Ben
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:rdb="http://namespaces.zope.org/rdb"
xmlns:sqlos="http://namespaces.sqlobject.org/sqlos"
i18n_domain="portfolio">
<sqlos:connectionName name="photodb"/>
<rdb:provideConnection name="photodb"
component="mysqldbda.adapter.MySQLdbAdapter"
dsn="dbi://root:XXX@localhost/photodb"/>
<browser:editform schema="portfolio.interfaces.IPortfolioImage"
name="edit.html" menu="zmi_views" label="Edit a Portfolio Image"
permission="zope.ManageContent"/>
<content class="portfolio.PortfolioImage">
<require permission="zope.ManageContent"
interface="portfolio.interfaces.IPortfolioImage"
set_schema="portfolio.interfaces.IPortfolioImage"/>
</content>
<sqlos:factory component="portfolio.PortfolioImage"
id="PortfolioImage" title="Portfolio Image" description="A Portfolio
Image"/>
<content class="portfolio.PortfolioImageContainer">
<implements
interface="zope.app.container.interfaces.IContentContainer"/>
<factory id="portfolio.PortfolioImageContainer"
title="Portfolio Image Container"
description="A container for SQLObject Portfolio Images"/>
<require permission="zope.View"
interface="zope.app.container.interfaces.IReadContainer"/>
<require permission="zope.ManageContent"
interface="zope.app.container.interfaces.IWriteContainer"/>
<require permission="zope.View" attributes="select"/>
</content>
<browser:addMenuItem class="portfolio.PortfolioImageContainer"
title="Portfolio Image Container"
description="A persistent container for SQL-backed Portfolio
Image objects"
permission="zope.ManageContent"/>
</configure>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: traceback.txt
Url: http://codespeak.net/pipermail/z3-sqlos/attachments/20050413/9a01244f/attachment.txt
-------------- next part --------------
((Ben Godfrey) (Software) (see "http://www.cohack.com/?src=eval"))
More information about the z3-sqlos
mailing list