[Zope-Coders] Minor corrections to the ZCatalog API

Steve Alexander steve@cat-box.net
Mon, 01 Oct 2001 23:18:39 +0100


Chris McDonough wrote:

 > Steve,
 >
 > Thanks!
 >
 > I don't understand, however, how this doesn't have any documentation
 >  impact if the API is changing.  I also don't understand how it
 > maintains backwards-compatibility.


Good points.

The corrections are to the API for plug-in indexes. The API was 
incorrectly and inconsistently named to start with.

It also seems to be undocumented. Please point me at any documentation 
you can find for these methods of ZCatalog.py:

   manage_delIndexes
   manage_deleteIndex
   manage_clearIndexes

Specifically, in ZCatalog.py:

   * There is a security declaration for manage_delIndexes, but there
     is no method by that name.

   * There is a method called manage_deleteIndex, which has no security
     declaration.

   * manage_delIndexes is called in regressionCatalogTiming.py

   * manage_delIndexes is called from catalogIndexes.dtml and
     manageIndex.dtml

   * The method manage_deleteIndex takes a sequence of index ids as
     an argument. The cardinality of its name is incorrect.

Therefore, I reckon the method is misnamed. A typo.


   * manage_clearIndex has no security declaration.

   * manage_clearIndex has the same pattern of signature as
     manage_delIndexes (aka manage_deleteIndex). That is, it
     takes a sequence of ids, not a single id.

   * manage_clearIndex is only used in manageIndex.dtml.

Therefore, I reckon it will be more consistent, and very little pain, to 
rename the method manage_clearIndex to manage_clearIndexes.

The same arguments that apply to manage_clearIndex also apply to 
manage_reindexIndex. It has no security declaration, is referenced in 
only one place, and must take a sequence of index ids.


In summary, there is virtually no backwards compatibility to be 
maintained, especially with manage_deleteIndex, which doesn't work from 
the ZMI anyway.

--
Steve Alexander