[Zope] zcatalog auto update

Casey Duncan casey@zope.com
Mon, 21 Oct 2002 09:52:47 -0400


On Mon, 21 Oct 2002 02:00:41 -0700 (PDT)
"michael.ta=F1ag" <almightymike@yahoo.com> wrote:

>=20
> hi! how do you make zope update the catalog automatically whenever a fi=
le has been uploaded?=20

Some options for you:

1. Use the CMF, CMF files already do this
2. Write a python script which adds the file and then indexes it, make th=
is python script the target action of the file upload form. Something lik=
e::

  form =3D context.REQUEST.form
  context.manage_addFile(id=3Dform['id'], file=3Dform['file'])
  file =3D context[form['id']]
  context.Catalog.catalog_object(file)
  context.REQUEST.RESPONSE.redirect('/some/page')

3. Create your own File class that subclasses OFS.Image.File and mixes in=
 the Products.ZCatalog.CatalogPathAwareness.CatalogAware class.

#1 and #3 are more complete solutions, but #2 is more customized.

hth,

-Casey