Skip to content

Commit

Permalink
do not hard depend on at anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens committed Dec 22, 2016
1 parent fe49bc3 commit 5b89c4c
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 43 deletions.
6 changes: 4 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Changelog
=========

3.2.4 (unreleased)
3.3.0 (unreleased)
------------------

Breaking changes:
Expand All @@ -10,7 +10,9 @@ Breaking changes:

New features:

- *add item here*
- Do not depend on Products.Archetypes anymore.
If Archetypes is present it still registers the adapters.
[jensens]

Bug fixes:

Expand Down
15 changes: 15 additions & 0 deletions plone/app/iterate/at.zcml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:zcml="http://namespaces.zope.org/zcml"
i18n_domain="plone">

<class class="Products.Archetypes.BaseObject.BaseObject">
<implements interface=".interfaces.IIterateAware" />
</class>

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

</configure>
9 changes: 1 addition & 8 deletions plone/app/iterate/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,7 @@
factory=".profiles.HiddenProfiles"
/>

<!-- 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
Expand Down Expand Up @@ -104,5 +96,6 @@
/>

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

</configure>
2 changes: 1 addition & 1 deletion plone/app/iterate/copier.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
##################################################################

"""
$Id: copier.py 1824 2007-02-08 17:59:41Z hazmat $
Archtypes specific copier, dexterity folder has its own!
"""

from Acquisition import aq_base
Expand Down
7 changes: 1 addition & 6 deletions plone/app/iterate/dexterity/copier.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,10 @@
from zope.annotation.interfaces import IAnnotations
from zope.event import notify
from zope.interface import implementer
from zope.intid.interfaces import IIntIds
from zope.schema import getFieldsInOrder


try:
from zope.intid.interfaces import IIntIds
except ImportError:
from zope.app.intid.interfaces import IIntIds


@implementer(interfaces.IObjectCopier)
class ContentCopier(copier.ContentCopier):

Expand Down
7 changes: 1 addition & 6 deletions plone/app/iterate/dexterity/relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
from zope.annotation.interfaces import IAttributeAnnotatable
from zope.component import getUtility
from zope.interface import implementer


try:
from zope.intid.interfaces import IIntIds
except ImportError:
from zope.app.intid.interfaces import IIntIds
from zope.intid.interfaces import IIntIds


@implementer(IStagingRelationValue, IAttributeAnnotatable)
Expand Down
7 changes: 1 addition & 6 deletions plone/app/iterate/dexterity/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
from plone.app.iterate.dexterity import ITERATE_RELATION_NAME
from zc.relation.interfaces import ICatalog
from zope import component


try:
from zope.intid.interfaces import IIntIds
except ImportError:
from zope.app.intid.interfaces import IIntIds
from zope.intid.interfaces import IIntIds


def get_relations(context):
Expand Down
13 changes: 12 additions & 1 deletion plone/app/iterate/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,23 @@
from plone.app.iterate import PloneMessageFactory as _
from plone.locking.interfaces import LockType
from plone.locking.interfaces import MAX_TIMEOUT
from Products.Archetypes.interfaces import IReference
from zope import schema
from zope.component.interfaces import IObjectEvent
from zope.interface import Attribute
from zope.interface import Interface

import pkg_resources


try:
pkg_resources.get_distribution('Products.Archetypes')
except pkg_resources.DistributionNotFound:

class IReference(Interface):
pass
else:
from Products.Archetypes.interfaces import IReference


################################
# Marker interface
Expand Down
2 changes: 1 addition & 1 deletion plone/app/iterate/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##################################################################
"""
A Default Checkin Checkout Policy For Content
Archetypes Checkin Checkout Policy For Content
"""

Expand Down
2 changes: 1 addition & 1 deletion plone/app/iterate/relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##################################################################
"""
$Id: relation.py 1392 2006-06-20 01:02:17Z hazmat $
Archetypes speicifc implementation for relation handling
"""

from interfaces import ICheckinCheckoutReference
Expand Down
30 changes: 21 additions & 9 deletions plone/app/iterate/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
from plone.app.testing.layers import IntegrationTesting
from plone.testing import z2

import pkg_resources


try:
pkg_resources.get_distribution('Products.Archtypes')
except pkg_resources.DistributionNotFound:
HAS_AT = False
else:
HAS_AT = True


ADMIN = {
'id': 'admin',
Expand Down Expand Up @@ -42,14 +52,15 @@ class PloneAppIterateLayer(PloneSandboxLayer):

def setUpZope(self, app, configurationContext):
"""Setup Zope with Addons."""
import Products.ATContentTypes
self.loadZCML(package=Products.ATContentTypes)
z2.installProduct(app, 'Products.ATContentTypes')
if HAS_AT:
import Products.ATContentTypes
self.loadZCML(package=Products.ATContentTypes)
z2.installProduct(app, 'Products.ATContentTypes')

z2.installProduct(app, 'Products.Archetypes')
z2.installProduct(app, 'Products.ATContentTypes')
z2.installProduct(app, 'plone.app.blob')
z2.installProduct(app, 'plone.app.collection')
z2.installProduct(app, 'Products.Archetypes')
z2.installProduct(app, 'Products.ATContentTypes')
z2.installProduct(app, 'plone.app.blob')
z2.installProduct(app, 'plone.app.collection')

import plone.app.iterate
self.loadZCML(package=plone.app.iterate)
Expand All @@ -59,8 +70,9 @@ def setUpPloneSite(self, portal):
# restore default workflow
applyProfile(portal, 'Products.CMFPlone:testfixture')

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

applyProfile(portal, 'plone.app.iterate:default')
applyProfile(portal, 'plone.app.iterate:test')
Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,16 @@
'zope.lifecycleevent',
'zope.schema',
'zope.viewlet',
'Zope2',
],
extras_require={
'archetypes': [
'Products.Archetypes',
],
'test': [
'plone.app.testing',
'plone.app.contenttypes',
'plone.app.robotframework'
'plone.app.robotframework',
'Products.Archetypes',
]
},
entry_points="""
Expand Down

0 comments on commit 5b89c4c

Please sign in to comment.