ZCatalog would be easier to use if it had a recatalog_object method:

    def recatalog_object(self, obj, uid):
        """Adds object to the catalog if not already present.
        Removes old entry first, if already in present."""
        self.uncatalog_object(uid)
        self.catalog_object(obj, uid)

This, and a new method in Traverable.py would make cataloging in
ZPatterns SkinScript very easy indeed.

Add to Traversable.py:

    getPathAsString__roles__=None # Public
    def getPathAsString(self):
       '''Returns the physical path as a string.
       The returned string will always start with a slash.'''
       return join(self.getPhysicalPath(), '/')


Otherwise, ZCatalog could be altered to accept lists of strings as uid
method attributes, and automatically convert them into slash-separated
strings.

Example SkinScript:

WHEN OBJECT ADDED, CHANGED CALL Catalog.recatalog_object(self,
self.getPathAsString())
WHEN OBJECT DELETED CALL
Catalog.uncatalog_object(self.getPathAsString())

Any comments?

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net

_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )

Reply via email to