[Zope-CMF] Determining the current view
Sat, 8 Feb 2003 19:38:18 +0100
J C Lawrence wrote at 2003-2-8 01:56 -0800:
> I'm writing a page template for a side box which I only want to display
> for specific views of objects. How can I, in a page template,
> a) Check that the thing currently being viewed is not a page template
> or DTML method or script (ie it has to be a "real" object)?
You look at "here.meta_type" and check whether you like it...
> b) Check that the object view method on the object is being invoked,
> and not, for instance, folder_content, edit, or some other view of the
Not so easy:
The "view" method may be called when
* you do not specify an explicite template
* you use "view" explicitely
* you use the action, "view" is mapped to, directly.
You can approximate the first two reasons by comparing
"URL" with "here.getId or "here.absolute_url".
Acquisition may make it a bit more difficult.
The last case is more difficult, as "view" can be mapped
to different actions...