[Zope-CMF] zopefind problem?

Tres Seaver tseaver@palladion.com
Sun, 03 Jun 2001 23:33:05 -0400


marc lindahl wrote:

> Has anyone else gotten this?  I was doing a zopefind from the portal Members
> folder, looking for 'all' objects with id 'pp' (the name of a folder I
> forgot which member had it), and got this error:
> 
>  
>   Site Error
> 
>   An error was encountered while publishing this resource.
> 
>   AttributeError
> 
>   Sorry, a site error occurred.


<snip>


>   AttributeError: getId

Hmm, I can't reproduce that.  Basically, *every* object in the
ZODB should have a 'getId' method; I can't think how you got that
result.  could you write an ExternalMethod which calls ZopeFind
with default arguments, and then check each resulting object for
one without 'getId'?  Something like::

   import string
   from Acquisition import aq_base

   def FindObjectWithNoName( self ):
       nameless = []
       for id, obj in self.ZopeFind():
           if not hasattr( aq_base( obj ), 'getId' ):
               nameless.append( id )
       return string.join( nameless, '\n' )

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org