[Zope3-dev] Re: ZopeX3 with sqlos

Derrick 'dman' Hudson dman at dman13.dyndns.org
Mon Jul 5 17:27:57 EDT 2004


On Mon, Jul 05, 2004 at 04:35:48PM -0400, Roberto Melo Cavalcante wrote:
| Hi everybody,
| 
| I'm trying to use ZopeX3 with sqlos. My SQLObject is working fine. But I 
| can't figured out how can I make sqlos examples work. 5 days ago I have 
| sent an e-mail to sqlos' author asking help, but he didn't answer. Does 
| anyone have a recipe?
| Thanks.

I just went through this last night :-).  First, use SQLObject from
the svn trunk.  0.5.2 is too old.  (apparently sqlobject went through
some module and class name changes)  Second, add a "SQL Object Factory
Service" to your zope site.

That much is correct, I believe.  Following that I had to do a few
more things to get the contents page to display.  However those things
are not "proper" at all.  They will, however, get you to the point of
seeing something happen and from there you can figure out how to do it
the right way.  (that's the point I'm at now -- I need to look at it
and see why it didn't work the first time)

I modified the SQLObjectContainer class (in sqlos/container/__init_.py) adding
the line
    classNames = ('Person',)
where Person is the name of the sqlos:factory configured in ZCML.

I also modified sqlobject/dbconnection.py.  Around line 434, I added
the line
    self.query = 'SELECT * FROM acl'
right above where it says
    if dbconn.debug:
        dbconn.printDebug(rawconn, self.query, 'Select')
    self.dbconn._executeRetry(self.rawconn, self.cursor, self.query)

'ACL' is the name of the already-existing table I wanted to display
the contents of.  I kept seeing invalid SQL statements being
generated.  I don't know if that is a result of something else I set
wrong or a bug in sqlobject's trunk revision.  This hack let me
sidestep that issue for the time being.

HTH,
-D

-- 
"He is no fool who gives up what he cannot keep to gain what he cannot lose."
    --Jim Elliot
 
www: http://dman13.dyndns.org/~dman/            jabber: dman at dman13.dyndns.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20040705/cd438e4e/attachment.bin


More information about the Zope3-dev mailing list