[Zope-dev] Calling Catalog from python script

Randall F. Kern randy@spoke.net
Wed, 14 Feb 2001 15:59:28 -0800


What's wrong with AbstractCatalogBrain.getObject()?  Doesn't that work?

-Randy

> -----Original Message-----
> From: Casey Duncan [mailto:cduncan@kaivo.com]
> Sent: Wednesday, February 14, 2001 3:45 PM
> To: R. David Murray; zope-dev@zope.org
> Subject: Re: [Zope-dev] Calling Catalog from python script
>=20
>=20
> "R. David Murray" wrote:
> >=20
> > I'll probably figure this out as soon as I post like last=20
> time, but I've
> > been staring at it and can't see my mistake.  The following=20
> code returns
> > a list of None's:
> >=20
> > objs =3D []
> > for catent in container.Catalog(context.REQUEST):
> >   objs.append(container.Catalog.getobject(catent.data_record_id_))
> > return objs
> >=20
> > I've checked, and catent is a mybrains instance and=20
> catent.data_record_id_
> > has an increasing number as its value.  So why doesn't this work?
> >=20
> > Also, and this is a better reason for posting this to zope-dev than
> > asking for help is <grin>: why can't I say
> >=20
> >   catent.getobject()
> >=20
> > That would seem to be a lot more OOish.
> >=20
> > This is under Zope-2.3.0, by the way.
> >=20
> > --RDM
> >=20
> That code looks pretty good to me. Did you try updating the Catalog?
> Also, what happens if just append catent. Do you get something other
> than None then? I would assume so, but it might help to see=20
> exactly what
> the meta data is to identify the objects it "should" return.
>=20
> I agree that getobject should be a method of the result item, although
> implementing it might be a bit tricky to do. I looked into=20
> that a while
> back. Perhaps I should take another look at that...
>=20
> --=20
> | Casey Duncan
> | Kaivo, Inc.
> | cduncan@kaivo.com
> `------------------>
>=20
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -=20
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
>=20