Updating dexterity content with non-default "default view" (i.e. having a "layout" property)

Hi all,

I have some folderish dexterity content where the default view was changed

e.g. /profiles/types/my_custom_type.xml contains

  <property name="default_view">my_new_and_improved_view</property>
  <property name="view_methods">
    <element value="my_new_and_improved_view" />
    <element value="my_custom_view" /> <!-- obsolete -->
    <element value="view" />
  </property>

Updating the default_view property to my new template and registering it zcml generally causes the new view to be used. Except in a few content objects where the default view was manually set to another value by users and then reversed back to "my_custom_view". In the affected content, I found a property "layout" in the ZMI with this value.

Lazily and naively, I hoped that setting

  <property name="default_view_fallback">True</property>

would fall back to the view set as a default_view. No such luck. After googling for "default_view_fallback" I am under the impression (please correct me if wrong) that https://github.com/plone/Products.CMFDynamicViewFTI/blob/master/Products/CMFDynamicViewFTI/fti.py#L193 is responsible for getting the default view for my content but because plone_utils exists, the default_view_fallback check is never reached.

Do I have any options other than writing an upgrade step which checks my content for and removes this creatively named "layout" property? Did I miss some documentation somewhere?

Handling dynamic View is here in the docs. I would do this: iterate over all of your CT Objects and set the Layout via:

obj.setLayout("my_new_and_improved_view")

There is also a

<property name="immediate_view"> 

… not sure if that can be of any help

I think this is only the property for the view wich directly after you the content is added

Either this, or delete the layout attribute.

Thanks for the documentation link, am going to delete that attribute.

-N

Plone Foundation Code of Conduct