Bill Freeman wrote:
I'm writing a little product to allow plone manager role users to have
Varnish purge its cache by clicking a button in plone.
1. Am I re-inventing the wheel here? That is, is there already such a
product which I haven't noticed?
Not that I know of. It'd be a great idea, though.
I already have a tested python module that telnets to the Varnish CLI,
commands the purge, and parses the response.
It seems to me that the proper place for such a button is in the
@@maintenance-controlpanel.
No, that's the wrong place. That control panel is part of Plone core,
and CacheFu is not installed on many sites. Furthermore, people may not
be using Varnish, e.g. if they're on Windows.
2. Are there good reasons not to put it there?
See above.
I can subclass
plone.app.controlpanel.maintenance.MaintenanceControlPanel to add a an
@form.action() decorated method to handle a "purgevarnish" button, and
to specify my template rather than the one in plone.app.controlpanel, so
that I can add a from/fieldset/submit button.
You should either create a new control panel or make it part of CacheFu.
I'd prefer the latter.
I don't see any hooks for plugging in, say, a structure provider to add
my form, which is why I'm using my own copy of the template. That makes
me vulnerable to any future incompatabe tempate changes in
plone.app.controlpanel, but I'm guessing that it is pretty stable.
Until Plone 4, sure. But I'd just create a new control panel or submit a
patch to CacheFu itself.
3. Am I missing a cleaner way to do this (still as a new button on the
maintenance controlpanel)?
There's no easy way (save for a monkey patch) to add a new button to an
existing form. But like I said, it's the wrong thing to do here.
I don't add any new form data, so I presume that I can use the existing
MaintenanceControlPanelAdapter and its registration, just registering a
new browser page that uses my class instead.
4. Are there issues with that plan? For example, am I going to have to
come up with a way of making my registration more specific than the base
one?
See above.
Martin
--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers