Skip to content

Commit

Permalink
Added profile id "default" and deprecated id "plone.app.iterate".
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Hilbert committed Feb 26, 2016
1 parent 3ad24ac commit 9b79455
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 139 deletions.
16 changes: 16 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,26 @@ New:

- *add item here*

- plone.app.iterate depends on GenericSetup >= 1.8.2
for using a post_handler on registerProfile
[iham]

- Added naming of default GenericSetup profile as "default".
"plone.app.iterate" also exists to keep compatibility.
[iham]

- Added deprecation warning to GS profile "plone.app.iterate"
[iham]

Fixes:

- *add item here*

- No need to register as Zope2 Product anymore.
[iham]

- Some minor pep8 cleanup.
[iham]

3.1.4 (2015-11-16)
------------------
Expand Down
141 changes: 77 additions & 64 deletions plone/app/iterate/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,92 @@
xmlns:zcml="http://namespaces.zope.org/zcml"
i18n_domain="plone">

<include package="zope.annotation" />
<include package="Products.CMFCore" file="permissions.zcml" />
<include package="zope.annotation" />
<include package="Products.CMFCore" file="permissions.zcml" />

<include package=".subscribers"/>
<include package=".browser"/>
<include package=".subscribers"/>
<include package=".browser"/>

<!-- Set up as a Zope product and register an extension profile -->
<five:registerPackage package="." />
<includeDependencies package="." />

<genericsetup:registerProfile
name="plone.app.iterate"
title="Working Copy Support (Iterate)"
directory="profiles/default"
description="Adds working copy support (aka. in-place staging) to Plone."
<genericsetup:registerProfile
name="default"
title="Working Copy Support (Iterate)"
directory="profiles/default"
description="Adds working copy support (aka. in-place staging) to Plone."
provides="Products.GenericSetup.interfaces.EXTENSION"
/>

<!--
Remove, when CMFPlone no more depends on this profile.
Products.CMFPlone/Products/CMFPlone/MigrationTool.py:99:
Addon(profile_id=u'plone.app.iterate:plone.app.iterate')
-->
<genericsetup:registerProfile
name="plone.app.iterate"
title="Working Copy Support (Iterate)"
directory="profiles/default"
description="Adds working copy support (aka. in-place staging) to Plone."
provides="Products.GenericSetup.interfaces.EXTENSION"
post_handler=".setuphandlers.deprecate_profile"
/>

<genericsetup:registerProfile
name="test"
title="plone.app.iterate: Test fixture"
directory="profiles/test"
description="Extension profile to configure a test fixture"
for="Products.CMFPlone.interfaces.ITestCasePloneSiteRoot"
provides="Products.GenericSetup.interfaces.EXTENSION"
/>

<genericsetup:registerProfile
name="test"
title="plone.app.iterate: Test fixture"
directory="profiles/test"
description="Extension profile to configure a test fixture"
for="Products.CMFPlone.interfaces.ITestCasePloneSiteRoot"
provides="Products.GenericSetup.interfaces.EXTENSION"
/>

<genericsetup:upgradeStep
source="*"
destination="121"
title="Reinstall plone.app.iterate"
description=""
profile="plone.app.iterate:plone.app.iterate"
handler="plone.app.iterate.util.upgrade_by_reinstall"
/>

<!-- Policy and behaviour for basic objects -->
<class class="Products.Archetypes.BaseObject.BaseObject">
<implements interface=".interfaces.IIterateAware" />
</class>

<adapter factory=".policy.CheckinCheckoutPolicyAdapter" />
<adapter factory=".relation.CheckinCheckoutReferenceAdapter"/>
<adapter factory=".archiver.ContentArchiver" />
<adapter factory=".copier.ContentCopier" />

<!-- Checkout folder locators -->
<adapter
factory=".containers.HomeFolderLocator"
name="plone.app.iterate.home"
/>

<adapter
factory=".containers.ParentFolderLocator"
name="plone.app.iterate.parent"
/>

<!-- Handle deletions of working copies -->
<subscriber
for=".interfaces.IWorkingCopyRelation
zope.lifecycleevent.interfaces.IObjectRemovedEvent"
handler=".event.handleDeletion"
/>

<permission
id="plone.app.iterate.CheckInContent"
title="iterate : Check in content"
<genericsetup:upgradeStep
source="*"
destination="121"
title="Reinstall plone.app.iterate"
description=""
profile="plone.app.iterate:plone.app.iterate"
handler="plone.app.iterate.util.upgrade_by_reinstall"
/>

<permission
id="plone.app.iterate.CheckOutContent"
title="iterate : Check out content"
<!-- Policy and behavior for basic objects -->
<class class="Products.Archetypes.BaseObject.BaseObject">
<implements interface=".interfaces.IIterateAware" />
</class>

<adapter factory=".policy.CheckinCheckoutPolicyAdapter" />
<adapter factory=".relation.CheckinCheckoutReferenceAdapter"/>
<adapter factory=".archiver.ContentArchiver" />
<adapter factory=".copier.ContentCopier" />

<!-- Checkout folder locators -->
<adapter
factory=".containers.HomeFolderLocator"
name="plone.app.iterate.home"
/>

<include package=".dexterity" zcml:condition="installed plone.app.relationfield" />
<adapter
factory=".containers.ParentFolderLocator"
name="plone.app.iterate.parent"
/>

<!-- Handle deletions of working copies -->
<subscriber
for=".interfaces.IWorkingCopyRelation
zope.lifecycleevent.interfaces.IObjectRemovedEvent"
handler=".event.handleDeletion"
/>

<permission
id="plone.app.iterate.CheckInContent"
title="iterate : Check in content"
/>

<permission
id="plone.app.iterate.CheckOutContent"
title="iterate : Check out content"
/>

<include package=".dexterity" zcml:condition="installed plone.app.relationfield" />

</configure>
12 changes: 12 additions & 0 deletions plone/app/iterate/setuphandlers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
"""Deprecation warning for plone.app.iterate:plone.app.iterate profile."""

import warnings


def deprecate_profile(tool):
"""Deprecation profile plone.app.iterate."""
warnings.warn(
'The profile with id "plone.app.iterate" was renamed to "default".',
DeprecationWarning
)
42 changes: 25 additions & 17 deletions plone/app/iterate/testing.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Testing setup for integration and functional tests."""
# -*- coding: utf-8 -*-
from plone.app.contenttypes.testing import PloneAppContenttypes
from plone.app.testing import PLONE_FIXTURE
Expand All @@ -8,37 +9,39 @@
from plone.testing import z2


admin = {
ADMIN = {
'id': 'admin',
'password': 'secret',
'roles': ['Manager'],
}
editor = {
EDITOR = {
'id': 'editor',
'password': 'secret',
'roles': ['Editor'],
}
contributor = {
CONTRIBUTOR = {
'id': 'contributor',
'password': 'secret',
'roles': ['Contributor'],
}
users_to_be_added = (
admin,
editor,
contributor,
USERS_TO_BE_ADDED = (
ADMIN,
EDITOR,
CONTRIBUTOR,
)
users_with_member_folder = (
editor,
contributor,
USERS_WITH_MEMBER_FOLDER = (
EDITOR,
CONTRIBUTOR,
)


class PloneAppIterateLayer(PloneSandboxLayer):
"""Plone Sandbox Layer for plone.app.iterate."""

defaultBases = (PLONE_FIXTURE,)

def setUpZope(self, app, configurationContext):
"""Setup Zope with Addons."""
import Products.ATContentTypes
self.loadZCML(package=Products.ATContentTypes)
z2.installProduct(app, 'Products.ATContentTypes')
Expand All @@ -50,27 +53,27 @@ def setUpZope(self, app, configurationContext):

import plone.app.iterate
self.loadZCML(package=plone.app.iterate)
z2.installProduct(app, 'plone.app.iterate')

def setUpPloneSite(self, portal):
"""Setup Plone Site with Addons."""
# restore default workflow
applyProfile(portal, 'Products.CMFPlone:testfixture')

# add default content
applyProfile(portal, 'Products.ATContentTypes:content')

applyProfile(portal, 'plone.app.iterate:plone.app.iterate')
applyProfile(portal, 'plone.app.iterate:default')
applyProfile(portal, 'plone.app.iterate:test')

for user in users_to_be_added:
for user in USERS_TO_BE_ADDED:
portal.portal_membership.addMember(
user['id'],
user['password'],
user['roles'],
[],
)

for user in users_with_member_folder:
for user in USERS_WITH_MEMBER_FOLDER:
mtool = portal.portal_membership
if not mtool.getMemberareaCreationFlag():
mtool.setMemberareaCreationFlag()
Expand Down Expand Up @@ -111,15 +114,20 @@ def setUpPloneSite(self, portal):


class DexPloneAppIterateLayer(PloneAppContenttypes):
"""Dexterity based Plone Sandbox Layer for plone.app.iterate."""

def setUpZope(self, app, configurationContext):
super(DexPloneAppIterateLayer, self).setUpZope(app, configurationContext)
"""Setup Zope with Addons."""
super(DexPloneAppIterateLayer,
self).setUpZope(app, configurationContext)

import plone.app.iterate
self.loadZCML(package=plone.app.iterate)
z2.installProduct(app, 'plone.app.iterate')

def setUpPloneSite(self, portal):
"""Setup Plone Site with Addons."""
super(DexPloneAppIterateLayer, self).setUpPloneSite(portal)
applyProfile(portal, 'plone.app.iterate:plone.app.iterate')
applyProfile(portal, 'plone.app.iterate:default')


PLONEAPPITERATEDEX_FIXTURE = DexPloneAppIterateLayer()
Expand Down
Loading

0 comments on commit 9b79455

Please sign in to comment.