[Zope-CMF] [dev] type actions, views and aliases: a proposal
Yuppie
schubbe@web.de
Fri, 20 Jun 2003 13:29:34 +0200
Hi!
Today is my proposal day. Here is the second one:
Context / Problem
=================
I'm still not happy with the limitations for type actions caused by
getActionById and _getViewFor.
_getViewFor is used by the view() method to return the default view.
The view method allows to add a simple +'/view' to urls.
www.example.org/foo/view
is an alias for
www.example.org/foo/document_view
-or-
www.example.org/foo/newsitem_view
-or-
www.example.org/foo/whatever_the_default_view_is
But we can't get rid of these urls, because we can't use them in
actions. If we would add an action like that,
{ 'id':'view',
'name':'View',
'action':'string:${object_url}/view',
'permissions':(View,) }
there would be no way to find out that /view is an alias for
/document_view, because actions are currently used to look up these
method aliases.
getActionById does something similar, so this is what I propose:
Proposal / Solution
===================
I'd like to add a dictionary to TypeInformations that maps aliases to
methods and is configurable TTW.
e.g.
{'view':'document_view',
'edit':'document_edit_form',
'metadata':'metadata_edit_form'}
That might look like redundant information, because right now we can get
this information from the actions. But the need to store this
information inside actions limits the use of actions right now and makes
type actions different from other actions.
getActionById and _getViewFor could use that dict instead of actions. In
fact they'll become useless:
A __before_publishing_traverse__ in PortalContent could do the mapping.
That allows to always use the defined aliases, e.g.:
www.example.org/foo/view
www.example.org/foo/edit
www.example.org/foo/metadata
Any thoughts? Comments are welcome.
Cheers,
Yuppie