[ZPT] Template/Script Access Via "Manager" Script
Dieter Maurer
dieter@handshake.de
Wed, 18 Dec 2002 23:30:41 +0100
Dirk Leas writes:
> I'd like to be access all my Zope objects (templates and scripts)
> through a single script. How can I "protect" or hide supporting forms
> from direct access, but still alow my "manager" to redirect to them? The
> manager will be doing some workflow/state management.
Your question is not very clear.
What do you mean with "direct access"?
What is "redirecting to them by manager"?
When I assume that "direct access" should mean "through the Web access"
and "redirecting to them by manager" should mean "they should still
be manageable", then one answer is:
When an object is "called" through the Web, ZPublisher looks for
an "index_html" attribute (and acquires it, if necessary).
When it does not find one or it is "None", it tries to call
the object directly. Otherwise, it calls "index_html".
Scripts, templates and so on, define "index_html=None" to
get their "__call__" method called.
This gives you a way to prevent direct through the Web access
by setting an (non-None) "index_html" attribute.
A long time ago, I posted an External Method to the mailing list
that allows you to set/reset an "index_html" attribute for any object.
Either search the mailing list archive or do it directly (it is not
difficult).
Dieter