[Zope] Using Catalog in a stand-alone application

Jonathan dev101 at magma.ca
Fri Jun 17 12:54:08 EDT 2005


----- Original Message ----- 
From: "Noam Raphael" <noamraph at gmail.com>
> I intend to write a free (GPL) application for browsing and searching
> a large collection of classic Hebrew texts, such as the bible. I want
> to write it in Python, which is a language that I like very much. It
> is supposed to be a stand-alone application, which could be
> distributed on a CD.
>
> Some semi-special things I want the search to be able to do: It should
> be possible to select which books to search. I might want to allow
> some specific variations on the typed words, which are common in
> Hebrew. Another thing that may be nice is to find multiple results
> within one document, since some texts are quite long.
>
> I've found that Zope's ZCatalog is based on Catalog, which is said to
> be possible to run without the full Zope. If you are familiar with
> ZCatalog, perhaps you can help me a bit, or point me to places where
> to find what I need. I ask, first, if it is reasonable to use Catalog
> for such a task. I also want to know which parts of Zope are relevant
> for what I need. A general overview about how it works would also be
> very nice.

Here are some code chunks that may get you going in the right direction:

#!/apps/zope/bin/python
sys.path.append("/apps/zope/lib/python")    # change this to work in your 
environment
import Zope
app=Zope.app()
from Testing import makerequest
app = makerequest.makerequest(app)

REQUEST = app.REQUEST

newobj = app.sw.WebSitesFolder.WebSitesData.manage_addProduct 
['SWV2'].WebSites.createInObjectManager(REQUEST['id'], REQUEST)

app.sw.WebSitesFolder.Catalog.catalog_object(newobj, recid)


This was taken from a stand-alone python routine which we use to bulk update 
a ZCatalog (data read in from files on the filesystem).  Zope is not running 
when we execute this routine.

HTH

Jonathan 




More information about the Zope mailing list