[Zope] bug?

Peter Bengtsson peterbe at gmail.com
Wed Jul 6 07:09:34 EDT 2005


Easy. The brain object doesn't have a 'getId()' method. The Catalog has.
What you're probably after is something like this::

 for brain in context.Catalog.searchResults({'bool':1}):
      cataloged_object = brain.getObject()
      if cataloged_object is None:
          print "ZCatalog out of sync!!"
      else:
          print cataloged_object.getId()

On 7/6/05, Jürgen Herrmann <Juergen.Herrmann at xlhost.de> wrote:
> hi there!
> 
> either this is a bug or i'm too stoned to see, what's going on...
> 
> i have a folder /1, 2 subfolders /1/11 and /1/22. each subfolder
> has a property 'bool', which is a boolean.
> there's a zcatalog instance in /1/Catalog with one index bool, indexed
> attribute 'bool'. i cataloged the two subfolders of /1 there.
> 
> i have i skript /1/test with the following content:
> results = context.Catalog.searchResults({'bool':1})
> print results
> for o in results:
>   print o
>   print o.getId
>   print o.getId()
> return printed
> 
> it prints:
> [<Products.ZCatalog.Catalog.mybrains object at 0xb629798c>,
> <Products.ZCatalog.Catalog.mybrains object at 0xb40d9dec>]
> <Products.ZCatalog.Catalog.mybrains object at 0xb629798c>
> <bound method ZCatalog.getId of <ZCatalog at /1/Catalog>>
> Catalog
> <Products.ZCatalog.Catalog.mybrains object at 0xb40d9dec>
> <bound method ZCatalog.getId of <ZCatalog at /1/Catalog>>
> Catalog
> 
> why in the world is o.getId a bound method of /1/Catalog?
> o is a mybrains instance!!!
> 
> what am i missing?! help!
> 
> regards, juergen herrmann
> _______________________________________________________________________
> 
> >> XLhost.de - eXperts in Linux hosting <<
> 
> Juergen Herrmann
> Weiherweg 10, 93051 Regensburg, Germany
> Fon:  +49 (0)700 XLHOSTDE [0700 95467833]
> Fax:  +49 (0)721 151 463027
> 
> ICQ:  27139974  -  IRC: #XLhost at quakenet
> WEB:  http://www.XLhost.de
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 


-- 
Peter Bengtsson, 
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Zope mailing list