[TransWarp] any ideas

Phillip J. Eby pje at telecommunity.com
Tue Jun 24 11:47:58 EDT 2003

At 10:36 AM 6/24/03 -0500, darryl wrote:
>I'm playing with postgresql connections still and am now trying
>the pyPgSQL driver, for no reason other than to try and figure things
>out a little.
>All did was change
>API = binding.bindTo("import:pgdb")
>API= binding.bindTo("import:pyPgSQL.PgSQL")
>in SQL.py
>Am I correct in thinking that binding.bindTo("import:pyPgSQL.PgSQL")
>is functionaly equivalent to
>from pyPgSQL import PgSQL

Yes it is.

>from peak.api import config,storage
>db=root.lookupComponent('pgsql://%s:%s@localhost/osims' % (user,passwd))
>for row in db('select * from osims_ccn'):
>                 print row
>I get this traceback:
>Traceback (most recent call last):
>   File "/home/darryl/peaktest.py", line 8, in ?
>     for row in db('select * from osims_ccn'):
>   File
>line 221, in __call__
>     cursor = self.cursorClass(self, **kw)
>   File
>line 53, in __init__
>     self.setParentComponent(parentComponent,componentName)
>   File
>line 847, in setParentComponent
>     self.__componentName = componentName
>   File "/usr/local/lib/python2.2/site-packages/peak/storage/SQL.py", line
>74, in __setattr__
>     setattr(self._cursor,attr,val)
>   File "/usr/local/lib/python2.2/site-packages/pyPgSQL/PgSQL.py", line
>2618, in __setattr__
>     raise AttributeError, name
>AttributeError: _Component__componentName

Ooh, that's an interesting bug you've found there.  Very 
subtle.  SQLCursor.__setattr__() doesn't work correctly if the attribute's 
value in the class is None.  I've just checked in a fix.  Thanks for the 

Currently, there are no functional tests for any of PEAK's database 
support, so I don't notice when things end up broken.  I hope to have some 
kind of functional test suite established by August.

More information about the PEAK mailing list