[Zope3-Users] sqlobject and psycopg
Tom Dossis
td at yoma.com.au
Tue Feb 8 11:33:08 EST 2005
Not sure if this will help...
"use the sqlos package to use SQLObject together with Zope 3"
http://codespeak.net/z3/sqlos/
Luca Manini wrote:
> Hi,
>
> I have some simple Python classes that use SQLObject and PostgreSQL
> for persistence (both from Debian unstable).
>
> I'm trying to integrate those classe in a module I'm writing for Zope
> 3 (Zope 3 from svn).
>
> The first thing I've tried is to make a folderish class with a view
> that list the instances of my class.
>
> Getting the instances is very easy from plain Python as class
> SQLObject has two methods setConnection() and select() that do the
> job.
>
> My problem is that the very same code does not work from Zope. I get a
> traceback like this:
>
> File "/home/manini/projects/endian/network/trunk/zope_en/browser/views.py", line 27, in get_lines
> Product.setConnection(__connection__)
> File "/usr/lib/python2.3/site-packages/sqlobject/main.py", line 1102, in setConnection
> value = dbconnection.connectionForURI(value)
> File "/usr/lib/python2.3/site-packages/sqlobject/dbconnection.py", line 601, in connectionForURI
> conn = self.schemeBuilders[scheme]().connectionFromURI(uri)
> File "/usr/lib/python2.3/site-packages/sqlobject/postgres/pgconnection.py", line 45, in connectionFromURI
> return cls(host=host, db=path, user=user, passwd=password, **args)
> File "/usr/lib/python2.3/site-packages/sqlobject/postgres/pgconnection.py", line 24, in __init__
> import psycopg
> File "/usr/local/src/zope_3/trunk/src/zodbcode/module.py", line 274, in __import__
> return self._saved_import(name, globals, locals, fromlist)
> File "/usr/local/src/zope_3/trunk/src/zodbcode/module.py", line 271, in __import__
> fromlist)
> File "/usr/local/src/zope_3/trunk/src/zodbcode/module.py", line 239, in _import
> mod = registry.findModule(fullname)
> AttributeError: 'str' object has no attribute 'findModule'
>
> For what I can understand the problem is that the import of psycopg is
> made in some 'strange' way, but I can not get more far that this.
>
> Google found this link
>
> http://mail.zope.org/pipermail/zope3-dev/2004-June/011469.html
>
> So I'm not the only one :-) but I still have no solution.
>
>
> Any hint?
> TIA, Luca
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>
More information about the Zope3-users
mailing list