Skip to content

Commit

Permalink
Merge c18cbd5 into 50510dc
Browse files Browse the repository at this point in the history
  • Loading branch information
hvelarde committed Aug 23, 2018
2 parents 50510dc + c18cbd5 commit 1a0c3ad
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Expand Up @@ -7,11 +7,15 @@ There's a frood who really knows where his towel is.
^^^^^^^^^^^^^^^^^^

.. warning::
The PFG tile is now deprecated an will be removed in collective.cover 3.
This version removes the hard dependency on ``plone.app.relationfield``;
you must use the ``[relations]`` extra if you are using the ``IRelatedItems`` behavior.
Upgrading from versions below 1.2b1 is no longer supported.
You must upgrade at least to version 1.2b1 before upgrading to this release.

- Deprecate PFG tile; it will remain available in Plone 4, but not in Plone 5.
[hvelarde]

- Remove hard dependency on ``plone.app.relationfield``;
if you use the ``IRelatedItems`` behavior you must use the ``[relations]`` extra (closes `#684 <https://github.com/collective/collective.cover/issues/684>`_).
[hvelarde]
Expand Down
8 changes: 3 additions & 5 deletions README.rst
Expand Up @@ -18,9 +18,9 @@ contents, built around a drag-and-drop interface.
like `Mosaic <https://pypi.python.org/pypi/plone.app.mosaic>`_,
the new layout solution for Plone.

.. warning::
This package is not compatible with Plone 5.
See ''Known issues'' for more information.
.. info::
Starting from version 2.0b1 this package is compatible with Plone 5.1;
nevertheless, there are some `known issues <https://github.com/collective/collective.cover/issues?q=is%3Aissue+is%3Aopen+label%3A%22plone+5%22>`_.

Demo
^^^^
Expand Down Expand Up @@ -89,8 +89,6 @@ Got an idea? Found a bug? Let us know by `opening a support ticket <https://gith
Known issues
^^^^^^^^^^^^

* Not compatible with Plone 5;
see the `list of related issues <https://github.com/collective/collective.cover/issues/642>`_ if you want to help.
* `Package is not compatible with standard Plone tiles <https://github.com/collective/collective.cover/issues/81>`_.
This will be addressed in a future release, if we get an sponsor.

Expand Down
5 changes: 5 additions & 0 deletions docs/end-user.rst
Expand Up @@ -109,6 +109,11 @@ Right now, you can not edit individual items metadata in the list, but you can
remove or reorder them. The title and image fields will include a link to the
original object location.

FormGen
+++++++

A tile to show a 'FormFolder' is also included in Plone 4 but is now deprecated; do not use it.

Rich Text
+++++++++

Expand Down
1 change: 0 additions & 1 deletion setup.py
Expand Up @@ -101,7 +101,6 @@
'plone.browserlayer',
'plone.cachepurging',
'plone.testing',
'Products.PloneFormGen <1.8.0.alpha1',
'tzlocal',
],
},
Expand Down
19 changes: 11 additions & 8 deletions src/collective/cover/testing.py
Expand Up @@ -8,7 +8,7 @@
installed under Plone 4.3, if requested; installed under Plone 5
Products.PloneFormGen
installed under Plone 4 only
installed under Plone 4 only (now deprecated)
"""
from collective.cover.config import IS_PLONE_5
from collective.cover.tests.utils import create_standard_content_for_tests
Expand All @@ -34,12 +34,15 @@
# this environment variable is set in .travis.yml test matrix
DEXTERITY_ONLY = os.environ.get('DEXTERITY_ONLY') is not None


# XXX: PFG tile is deprecated and will be removed in collective.cover 3
try:
pkg_resources.get_distribution('Products.PloneFormGen')
except pkg_resources.DistributionNotFound:
HAS_PFG = False
else:
HAS_PFG = True
# XXX: even if product is present, PFG tile must not be available
HAS_PFG = True if not IS_PLONE_5 else False

ALL_CONTENT_TYPES = [
'Collection',
Expand Down Expand Up @@ -142,10 +145,10 @@ def setUpZope(self, app, configurationContext):
self.loadZCML(package=plone.app.contenttypes)
z2.installProduct(app, 'Products.DateRecurringIndex')

if HAS_PFG:
import Products.PloneFormGen
self.loadZCML(package=Products.PloneFormGen)
z2.installProduct(app, 'Products.PloneFormGen')
if HAS_PFG:
import Products.PloneFormGen
self.loadZCML(package=Products.PloneFormGen)
z2.installProduct(app, 'Products.PloneFormGen')

import collective.cover
self.loadZCML(package=collective.cover)
Expand All @@ -164,8 +167,8 @@ def setUpPloneSite(self, portal):
if DEXTERITY_ONLY:
self.applyProfile(portal, 'plone.app.contenttypes:default')

if HAS_PFG:
self.applyProfile(portal, 'Products.PloneFormGen:default')
if HAS_PFG:
self.applyProfile(portal, 'Products.PloneFormGen:default')

self.applyProfile(portal, 'collective.cover:default')
self.applyProfile(portal, 'collective.cover:testfixture')
Expand Down
11 changes: 8 additions & 3 deletions src/collective/cover/tests/test_pfg_tile.py
@@ -1,4 +1,10 @@
# -*- coding: utf-8 -*-
"""Test for the PloneFormGen tile.
They run only if Products.PloneFormGen is installed.
XXX: PFG tile is deprecated and will be removed in collective.cover 3
"""
from collective.cover.tests.base import TestTileMixin
from collective.cover.tiles.pfg import IPFGTile
from collective.cover.tiles.pfg import PFGTile
Expand Down Expand Up @@ -86,10 +92,9 @@ def test_render_restricted_object(self):


def test_suite():
# XXX: load tests only in Plone < 5
"""Run tests only if Products.PloneFormGen is installed."""
from collective.cover.testing import HAS_PFG
from collective.cover.config import IS_PLONE_5
if HAS_PFG and not IS_PLONE_5:
if HAS_PFG:
return unittest.defaultTestLoader.loadTestsFromName(__name__)
else:
return unittest.TestSuite()
6 changes: 5 additions & 1 deletion src/collective/cover/tests/test_vocabularies.py
Expand Up @@ -69,14 +69,18 @@ def test_enabled_tiles_vocabulary(self):
'collective.cover.embed',
'collective.cover.file',
'collective.cover.list',
'collective.cover.pfg', # FIXME: https://github.com/collective/collective.cover/issues/194
'collective.cover.richtext',
]

# FIXME: https://github.com/collective/collective.cover/issues/633
if IS_PLONE_5:
expected.remove('collective.cover.calendar')

# XXX: PFG tile is deprecated and will be removed in collective.cover 3
from collective.cover.testing import HAS_PFG
if HAS_PFG and 'collective.cover.pfg' not in expected:
expected.append('collective.cover.pfg')

self.assertEqual(len(tiles), len(expected))
for i in expected:
self.assertIn(i, tiles)
Expand Down
6 changes: 6 additions & 0 deletions src/collective/cover/tiles/pfg.py
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
"""PFG tile is deprecated and will be removed in collective.cover 3"""
from AccessControl import Unauthorized
from collective.cover import _
from collective.cover.tiles.base import IPersistentCoverTile
Expand All @@ -11,6 +12,11 @@
from zope import schema
from zope.interface import implementer

import warnings


warnings.warn(__doc__, DeprecationWarning)


class IPFGTile(IPersistentCoverTile):

Expand Down
8 changes: 8 additions & 0 deletions src/collective/cover/vocabularies.py
Expand Up @@ -40,6 +40,10 @@ def __call__(self, context):
if IS_PLONE_5 and 'collective.cover.calendar' in tiles:
tiles.remove('collective.cover.calendar')

# XXX: PFG tile is deprecated and will be removed in collective.cover 3
if IS_PLONE_5 and 'collective.cover.pfg' in tiles:
tiles.remove('collective.cover.pfg')

items = [SimpleTerm(value=i, title=i) for i in tiles]
return SimpleVocabulary(items)

Expand All @@ -64,6 +68,10 @@ def enabled(name):
if IS_PLONE_5 and name == 'collective.cover.calendar':
return False

# XXX: PFG tile is deprecated and will be removed in collective.cover 3
if IS_PLONE_5 and name == 'collective.cover.pfg':
return False

tile_type = queryUtility(ITileType, name)
if tile_type and tile_type.schema:
return issubclass(tile_type.schema, IPersistentCoverTile)
Expand Down
4 changes: 4 additions & 0 deletions versions-4.3.x.cfg
Expand Up @@ -2,6 +2,7 @@
test-eggs =
plone.app.contenttypes
plone.app.referenceablebehavior
Products.PloneFormGen

[versions]
# XXX: https://github.com/collective/collective.cover/issues/492
Expand All @@ -10,5 +11,8 @@ plone.app.blocks = 4.2.0
plone.app.tiles = 3.1.0
plone.tiles = 2.1

# XXX: PFG tile is deprecated and will be removed in collective.cover 3
Products.PloneFormGen = <1.8.0.alpha1

# XXX: https://github.com/plone/plone.api/issues/364
plone.api = 1.6
7 changes: 7 additions & 0 deletions versions-5.1.x.cfg
@@ -1 +1,8 @@
[buildout]
# XXX: even if product is present, PFG tile must not be available
test-eggs =
Products.PloneFormGen

[versions]
# XXX: PFG tile is deprecated and will be removed in collective.cover 3
Products.PloneFormGen = >=1.8.0.alpha1

0 comments on commit 1a0c3ad

Please sign in to comment.