[Zope-dev] ZODB, Catalog and actually using it
Casey Duncan
casey@ZOPE.COM
Wed, 29 May 2002 16:45:05 -0400
[removed zodb-dev, don't cross post!]
If you are using plain catalogs then you need to store the path to the ob=
ject=20
somewhere (as metadata or as Zope does as the uid of the catalog record).=
=20
Then traverse to it based on this path. In Zope you use (restrictedTraver=
se=20
(or unrestrictedTraverse) to do this). You might need to roll your own=20
traverser, but it shouldn't be too hard.
hth,
Casey
On Wednesday 29 May 2002 04:30 pm, Nicholas Henke wrote:
> On Wednesday 29 May 2002 04:20 pm, Casey Duncan wrote:
> > try:
> >
> > ob =3D r.getObject()
> > ob.function()
>=20
> ob gets returned as None -- I think this is due to=20
> AbstractCatalogBrain::getObject(). I don't believe self.aq_parent is se=
t=20
> correctly -- how is it supposed to be set ?
>=20
> >
> > or if that doesn't work:
> >
> > ob =3D catalog.getobject(r.data_record_id_)
> AttributeError -- getobject doesnt exist?
>=20
> > ob.function()
> >
> > Bear in mind that getObject traverses to the object which is expensiv=
e=20
both
> > in time and memory if the number of results is large.
>=20
> OK -- is there a better way to do all of this ? What I am trying to do=
is=20
> have ZODB store objects and Catalog maintain indexes on them. Now I can=
come=20
> back and do a 'SELECT' on the objects, say for variable !=3D 1, and som=
ehow=20
get=20
> access to the original objects if I wish to. Is there somewhere that=20
> documents using Catalog and PluginIndexes without all of the other Zope=
=20
> stuff? Any documents on using it with the Zope stuff ?
>=20
> Nic