Code review comment for lp:~leonardr/lazr.restful/register-operations-when-version-list-is-known

Revision history for this message
Leonard Richardson (leonardr) wrote :

The web service registration code runs in the first stage of ZCML processing. Originally, the adapter classes for entries, collections, and named operations were all generated in this first stage. Then came the multi-version code, and there was no way to generate a set of entries without knowing the list of active versions published by the web site.

Unfortunately, the list of active versions is a property of the IWebServiceConfiguration utility, and utilities are not available in the first stage of ZCML processing. So I wrote code that used context.action() to defer the entry generation code until the second stage of ZCML processing, when utilities are available.

The project I'm working on now (no longer exporting mutator methods as named operations) requires that the list of active versions be available when generating the adapters for named operations. This branch does the same trick for named operations as I did earlier for entries: uses context.action() to defer the generation code until the second stage of ZCML processing.

A side effect of this is that when naming the adapters for named operations, we can use the actual name of the first version instead of "__Earliest". I got rid of almost all instances of "__Earliest" in the tests. (There was one I couldn't get rid of, and since that's not the point of my project and it wasn't hurting anything, I've left it alone for now.)

« Back to merge proposal