[Zope-dev] urg

David Kankiewicz kankie@thegrid.net
Tue, 07 Mar 2000 08:49:42 -0800


Tom Deprez wrote:
> 
<snip> Just tell me where I'm wrong:
> 
> If we want to provide a search engine, so that the user can directly enter
> keywords, we've to descend our KBFolder from CatalogAware so that a
> ZCatalog can be used. The KBFolder name is used for searching. We get this
> tree
> 
> Python (KBFolder; Categorie: PYTHON)
> Zope (KBFolder; Categorie: ZOPE)
>    What is Zope? (KBItem)
>    Problem 1 (KBItem)
>    Python (KBFolder; Categorie PYTHON) !! -> Should be (ZOPE PYTHON)
>    DTML (KBFolder; Categorie DTML) !! -> Should be (ZOPE DTML)
>      What is DTML? (KBItem)
> 
> A user wants to search for 'ZOPE' AND 'PYTHON'
> 
>  If we use only the name of the folder as catalog then we get no result.
>  This is wrong, not? We've a category of Python within Zope. However it is
> categorised as PYTHON. It should be categorised as ZOPE PYTHON. And when we
> move the folder is should change it categories according to the KBFolders a
> top of itself. Not?
> 
> Please, tell me where my braintumor is messing my clear thinking.

Its the idea that on your first try working with classes in python,
Zope, subclassing, etc. you could get it to work :)

Maybe its the idea of "a property" that is messing you up. (I'm working
with the same parent-parent-etc. thing.)

The idea I am using is to store (in the catalog) the result of a
external method that returns the parent-parent string. This way any
cut-paste-move that updates the catalog, gets the new values.

something simple (I'm no python expert... change as needed, meta_type
typing etc.)

"parents.py":
from string import split

def parents(self):
    parentsnames = split(self.absolute_url(),'/')[3:-1]
   # [3:-1] removes the host info or use something different to split
on..
   # the -1 removes the last element, i.e. self.id
    return parentsnames


I use something similiar to store the parents in my Zcatalogs.

You may need to resolve_url to get the objects and do your checking,
etc..

regards,
David

> 
> Thanks in advance,
> 
> Tom.
> 
> >Rik
> >
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )