[Zope-dev] Calling Catalog from python script

R. David Murray bitz@bitdance.com
Fri, 16 Feb 2001 12:28:27 -0500 (EST)


On Fri, 16 Feb 2001, R. David Murray  wrote:
> Howevever, I'm still getting 'None' as the result.  If I print out, say,
> catent.id, I see the correct ID for the object I'm trying to retrieve.
> 
> It doesn't make sense that this is failing.  I must be doing something
> stupid but I still can't see it.  I tried calling getObject both with
> and without REQUEST as a parameter, with the same result.
> 
> I guess it's time for some more source spelunking.

And the expedition was a qualified success.  It turns out that
getObject has one of those nasty unadorned try: except: structures
in it.  It was masking an authorization error.  The auth error
is occuring in urestrictedTraverse, and the last lines of my traceback
are:

  File /usr/local/zope/Zope230/lib/python/OFS/Traversable.py, line 190, in unrestr
ictedTraverse
    (Object: ApplicationDefaultPermissions)
Unauthorized: 0060175400

0060175400 is the ID of the first object returned by the catalog.

Any guesses why this is happening?  I get the same result whether I'm anonymous
or logged in as a manager.

Also, anyone want to guess why getObject uses try/except?  I can't off
the top of my head think of any reason it should be there.

This is 2.3.0, I suppose I should try the new beta just for kicks...

--RDM