hi any body with ideas to index textfiles with ZCatalog? i've read cataloging everything with zcatalog, and would like to do the same with text files. i saw two steps 1-setup a ZSQL methods that returns what we want to index (return as PrincipiaSearchSource) 2-catalog the objects 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... thanks
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
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of bak (kedai)
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...
If you just make a external method or a Pyhton script on a class, and call it PrincipiaSearchSource. then catalog will find it when updating. So maybe you should make a wrapper class for the textfile and put the method in there. regards Max M
participants (3)
-
bak -
Dieter Maurer -
Max M