Frankline
Frankline

Reputation: 41025

Creating a working copy for Plone 4 custom content types

I have created a custom Plone content type in my package i.e. my.product.

I am in need of integrating a working copy support: so that a "published" document (in my case, a published content type) stays online while it is being edited. Basically, I want to take advantage of 'Working Copy Support (Iterate)' provided by plone.app.iterate to achieve what is explained here. This will provide me with ability to check-in/check-out my changes.

Is this possible in Plone 4 with custom content types using Archetypes? How would one go about it if yes?

Upvotes: 2

Views: 321

Answers (2)

Frankline
Frankline

Reputation: 41025

I added the following two files inside my.product/my/product/profiles/default folder and it appears to work:

diff_tool.xml

<?xml version="1.0"?>
<object>
    <difftypes>
        <type portal_type="MyCustomType">
            <field name="any" difftype="Compound Diff for AT types"/>
        </type>
    </difftypes>
</object>

repositorytool.xml

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

Upvotes: 2

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83546

I have never used plone.app.iterate, but this is the generic approach how to solve the problem.

Actions are installed by plone.app.iterate GenericSetup profile. You can see actions here:

https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/profiles/default/actions.xml

Pay note to the line *available_expr* which tells when to show the action or not. It points to helper view with the conditition.

The view is defined here

The checks that are performed for the content item if it's archiveable

Most likely the failure comes from if not interfaces.IIterateAware.providedBy condition. Your custom contennt must declare this interface. However, you can confirm this putting a pdb breakpoint in checkin_allowed(self) and step it though line-by-line and see what happens with your content type.

Upvotes: 1

Related Questions