immediate_view, or how I learnt to stop worrying and started loving the subtle breakage

"Martin Aspeli" <[email protected]>
Newsgroups gmane.comp.web.zope.plone.archetypes.devel
Message-ID <[email protected]>
So....

You've done this, haven't you?

class MyType(BaseContent):
   ....
   default_view = immediate_view = 'my_template'
   ...

well ... you were *WRONG*. :)

immediate_view is part of the FTI in CMF. It is the view that you see  
immediately after an object is created. That is - it's the "add form"  
(except the object already exists, whether in the factory or not), and  
should in most cases be base_edit, not base_view.

We want to fix this for Plone 2.5  
(https://dev.plone.org/plone/ticket/3965) because it solves a few use  
cases that are tricky otherwise, e.g. if you need a different form to  
initialise something when it's first created from the basic edit form.

However, Archetypes does this wrong, ATContentTypes does this wrong. And a  
lot of the documentation does this wrong.

For example:

  - TemplateMixin uses immediate_view as a fallback if it can't find the  
default_view (of course, TemplateMixin itself is a poor alternative to  
BrowserDefaultMixin, I wonder if anyone actually uses it).

  - All of ATContentTypes' content types (base.py, document.py, file.py  
etc.) have default_view == immediate_view

  = The ATCT docs/ExtendingType.txt promotes the default_view ==  
immediate_view misconception

  - PloneFolder.py gets it wrong, setting immediate_view = folder_listing

  - Various things in the plone GenericSetup profiles get it wrong

  - ArchetypeTool actually gets it right in the base FTI, but products can  
obviously override this very easily.

  - CMF's stock types obviously get it right

So ... what shall we do?

  - Break people who got it wrong in the past (it's obviously a simple fix,  
but it may piss people off)?

  - Use immediate_view only if immediate_view is not the same as  
default_view?

  - Live without this feature and admit we misunderstood?

Martin
-- 
(muted)



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.