[Zope] cataloging text files

Dieter Maurer dieter@handshake.de
Tue, 10 Jul 2001 20:22:12 +0200 (CEST)


bak (kedai) writes:
 > any body with ideas to index textfiles with ZCatalog?...
 > what/how can i do #1 with text files?  how can i retrun 
 > PrincipiaSearchSource?  i know how to treturn text, but not how to return it 
 > to the script that does the cataloging.  i can't think of a way...
One option would be to wrap your text file object into a ZClass,
that derives from "File" and has a DTML method
"PrincipiaSearchSource" with the definition:

	<dtml-var this>

The other option is to patch "OFS.Image.File" in a HotFix product
(--> HowTo on zope.org) and give it a "PrincipiaSearchSource"
method, like this:

	from OFS.Image import File

	File.PrincipiaSearchSource= File.__str__

  If this does not work, the you must also add a security
  declaration:

        File.PrincipiaSearchSource__roles__= File.index_html__roles__

  This assumes, the viewing the source is protected in the
  same way than viewing via the Web.


Dieter