[PEAK] naming.lookup() vs config.lookupComponent()

Doug Quale quale1 at charter.net
Mon Jun 21 19:53:04 EDT 2004


Taking baby steps with peak, I tried this:

---

from peak.api import *

URL = 'psycopg://quale:@localhost/template1'

root = config.makeRoot()

# I tried this first, but it fails:
#cx = naming.lookup(root, URL)
# The mailing list archives suggest this, which works well:
cx = root.lookupComponent(URL)

storage.beginTransaction(root)
cu = cx('select * from pg_tables') # naming.lookup() attempt hangs here
for row in cu:
    print row
storage.commitTransaction(root)

---

Now, cx = root.lookupComponent(URL) works fine, but
cx = naming.lookup(root, URL) hangs when the select query is attempted.

Why does the naming.lookup() try fail, and what is the difference
between root.lookupComponent() and naming.lookup()?



More information about the PEAK mailing list