[TransWarp] any ideas

darryl developer at csrules.dyndns.org
Tue Jun 24 11:36:32 EDT 2003


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")
to
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

--------
from peak.api import config,storage

root=config.makeRoot()
db=root.lookupComponent('pgsql://%s:%s@localhost/osims' % (user,passwd))
storage.beginTransaction(db)
for row in db('select * from osims_ccn'):
                print row
storage.commitTransaction(db)
---------

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
"/usr/local/lib/python2.2/site-packages/peak/storage/connections.py",
line 221, in __call__
    cursor = self.cursorClass(self, **kw)
  File
"/usr/local/lib/python2.2/site-packages/peak/storage/connections.py",
line 53, in __init__
    self.setParentComponent(parentComponent,componentName)
  File
"/usr/local/lib/python2.2/site-packages/peak/binding/components.py",
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






More information about the PEAK mailing list