Plone 5 Dexterity content type and plone.app.iterate

Does anyone know if the Check-in and Check-out functions from plone.app.iterate work with Dexterity custom content types in Plone 5? Is there a behavior I need to declare in my content types to enable plone.app.iterate to work with them? Any advice would be most appreciated.

Plone 5.0.7 (5017)
CMF 2.2.10
Zope 2.13.26
Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]
PIL 3.4.2 (Pillow)

Content-types (plone.app.contenttypes) 1.2.22
Dexterity versioning support 1.3
Working Copy Support (Iterate) 3.2.4

I think versioning has to be enabled.

Check the conditions in plone.app.iterate.browser.control.Control.checkout_allowed

pbauer, thank you for your help. I have already enabled versioning but I am not sure what I should do with plone.app.iterate.browser.control.Control.checkout_allowed. I inserted this as a behavior and it did not work. Where do I go to check the conditions for plone.app.iterate.browser.control.Control.checkout_allowed? Please advise. Thanks.

That is a python-path to the method that does the check if checkout is allowed. I would add a pdb there an see where it fails.

Oh, maybe you forgot to set a versioning-policy for the new type in @@content-controlpanel. Versioning is only really on if you did that. In your package that would means adding a repository_tool.xml with:

<?xml version="1.0"?>
<repositorytool>
 <policymap>
  <type name="yourtype">
   <policy name="at_edit_autoversion"/>
   <policy name="version_on_revert"/>
  </type>
 </policymap>
</repositorytool>

Thanks pbauer. I added repositorytool.xml to my package and I can see the Check Out option under Action. However, when I try to check out, the following errors are now showing up:
Traceback (innermost last): Module ZPublisher.Publish, line 138, in publish Module ZPublisher.mapply, line 77, in mapply Module ZPublisher.Publish, line 48, in call_object Module plone.app.iterate.browser.checkout, line 78, in __call__ Module plone.app.iterate.policy, line 71, in checkout Module zope.event, line 31, in notify Module zope.component.event, line 24, in dispatch Module zope.component._api, line 136, in subscribers Module zope.component.registry, line 321, in subscribers Module zope.interface.adapter, line 585, in subscribers Module plone.app.iterate.subscribers.locking, line 39, in handleCheckout Module plone.app.iterate.lock, line 37, in lockContext TypeError: ('Could not adapt', <Item at /EconomicBenefits/forms/administrative-letter-test>, <InterfaceClass plone.locking.interfaces.ILockable>)

Am I missing something?

pbauer,

Nevermind. I figured it out. I needed to add another behavior to the content type:
<element value="plone.app.lockingbehavior.behaviors.ILocking"/>

Once I added this in, everything worked perfectly. Thank you so much for all your help. Cheers.

1 Like

This sounds worthy of being added to the (Dexterity?) documentation.

You can just write it in short:

<element value="plone.locking"/>

Thanks so much, Kim. Anything that will help the Plone Community is always good! Cheers.

Jens, thank you so much. I did not know that there was an alternative to the statement I had. The long declaration came from Dexterity itself. Is there a way for me to find out if there are shorter statements to the element values that Dexterity provides? The following is what I am using in my current content type:
<element value="plone.app.content.interfaces.INameFromTitle" /> <element value="plone.app.dexterity.behaviors.metadata.IDublinCore"/> <element value="collective.dexteritytextindexer.behavior.IDexterityTextIndexer"/> <element value="plone.app.relationfield.behavior.IRelatedItems"/> <element value="plone.app.dexterity.behaviors.exclfromnav.IExcludeFromNavigation"/> <element value="plone.app.contenttypes.behaviors.tableofcontents.ITableOfContents"/> <element value="plone.app.versioningbehavior.behaviors.IVersionable"/> <element value="plone.app.lockingbehavior.behaviors.ILocking"/>

Thanks so much. Cheers.

@angelawong it is documented here at the Plone Documentation, Chapter Standard Behaviors

@jensens Thanks so much. It's much appreciated. Cheers.