[Zope-CMF] Re: Current action and action aliases

Yuppie schubbe at web.de
Fri Oct 10 04:33:49 EDT 2003


Hi!


Florent Guillaume wrote:
> Does the new action aliases code mean that there'll be an easy way to
> discover (from main_template for instance) what the current action is?
> 
> Standard use case is to highlight the current action in the actions box.
> I seem to remember that Plone uses a semi-hack to do this. In CPS 2 we
> used to have a "current_action" global variable set at the beginning of
> each template. But I'd like something cleaner than that and the aliases
> code seems the perfect place to do it.

Actions are absolute URLs. The current page is requested by an absolute 
URL. So I think in theory the simplest and best solution would be to 
compare URLs. If they are identical, the Action is the current Action.

On one hand Method Aliases make this easier: While aliases add more 
valid URLs, they allow to restrict URLs used in navigation to only one 
per Action.

On the other hand Method Aliases make this harder: In a virtual host 
environment, REQUEST has no key that shows the URL requested by the user.

Thinking about this, I'm afraid there is a general problem with the 
Method Aliases implementation. REQUEST's URL, URLx and BASEx show the 
modified URL. Regarding default views this breaks backwards 
compatibility and I'm not sure what REQUEST['URL'] should show: The 
original URL or the URL traversed to.

Maybe the VHM should add a key like VIRTUAL_URL that isn't changed on 
traversal like URL.

Or maybe I'm just missing something.


Cheers,
	Yuppie





More information about the Zope-CMF mailing list