[Zope-CMF] [dev] type actions, views and aliases: a proposal

Raphael Ritz r.ritz@biologie.hu-berlin.de
Fri, 20 Jun 2003 14:04:43 +0200


Not sure whether this is related but would this somehow affect the
following:

So far '/view' infers the default view even when the
'view' action in the types tool is set to something else.
(is that actually still the case in 1.4?)

Why on earth would you want that?

So far I use this for file objects because their
default view is the download action (and I think this is OK)
but when a file object appears in a search result or the
review slot (in Plone) I don't want to link to the download
but to the  descriptive view (title/name, size, description,
download link). Currently this can be differentiated via the
types tool
some_file_object/view -> gives you the download
some_file_object.getTypeInfo().getActionById('view') ->
gives you whatever you define as view in the types tool.

BTW: How do others deal with that issue?

Raphael
   

Yuppie wrote:

> 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
>
>
>
>
>
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
>
> See http://collector.zope.org/CMF for bug reports and feature requests
>