From 8898645d7c1e13f334bcd542eec152f68e5b4976 Mon Sep 17 00:00:00 2001 From: hvelarde Date: Tue, 1 Mar 2016 15:49:58 -0300 Subject: [PATCH 1/3] Refactor #591 --- CHANGES.rst | 3 +- src/collective/cover/testing.py | 21 +++++++++++++ src/collective/cover/tests/test_basic_tile.py | 4 +-- .../cover/tests/test_carousel_tile.py | 30 ++++--------------- src/collective/cover/tiles/carousel.py | 6 ++-- 5 files changed, 31 insertions(+), 33 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index f0ad8a97d..9e0be83e8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,7 +6,8 @@ There's a frood who really knows where his towel is. 1.0a13 (unreleased) ^^^^^^^^^^^^^^^^^^^ -- Accept collection and folder objects into carousel tile (closes `574`_). +- You can now use a collection to populate a carousel tile; + search results without a lead image will be bypassed (fixes `#574`_). [rodfersou] - Shows message to user if an exception is thrown in a tile (closes `#581`_). diff --git a/src/collective/cover/testing.py b/src/collective/cover/testing.py index 14ed085b8..73dafa865 100644 --- a/src/collective/cover/testing.py +++ b/src/collective/cover/testing.py @@ -51,6 +51,27 @@ ] +zptlogo = ( + 'GIF89a\x10\x00\x10\x00\xd5\x00\x00\xff\xff\xff\xff\xff\xfe\xfc\xfd\xfd' + '\xfa\xfb\xfc\xf7\xf9\xfa\xf5\xf8\xf9\xf3\xf6\xf8\xf2\xf5\xf7\xf0\xf4\xf6' + '\xeb\xf1\xf3\xe5\xed\xef\xde\xe8\xeb\xdc\xe6\xea\xd9\xe4\xe8\xd7\xe2\xe6' + '\xd2\xdf\xe3\xd0\xdd\xe3\xcd\xdc\xe1\xcb\xda\xdf\xc9\xd9\xdf\xc8\xd8\xdd' + '\xc6\xd7\xdc\xc4\xd6\xdc\xc3\xd4\xda\xc2\xd3\xd9\xc1\xd3\xd9\xc0\xd2\xd9' + '\xbd\xd1\xd8\xbd\xd0\xd7\xbc\xcf\xd7\xbb\xcf\xd6\xbb\xce\xd5\xb9\xcd\xd4' + '\xb6\xcc\xd4\xb6\xcb\xd3\xb5\xcb\xd2\xb4\xca\xd1\xb2\xc8\xd0\xb1\xc7\xd0' + '\xb0\xc7\xcf\xaf\xc6\xce\xae\xc4\xce\xad\xc4\xcd\xab\xc3\xcc\xa9\xc2\xcb' + '\xa8\xc1\xca\xa6\xc0\xc9\xa4\xbe\xc8\xa2\xbd\xc7\xa0\xbb\xc5\x9e\xba\xc4' + '\x9b\xbf\xcc\x98\xb6\xc1\x8d\xae\xbaFgs\x00\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' + '\x00,\x00\x00\x00\x00\x10\x00\x10\x00\x00\x06z@\x80pH,\x12k\xc8$\xd2f\x04' + '\xd4\x84\x01\x01\xe1\xf0d\x16\x9f\x80A\x01\x91\xc0ZmL\xb0\xcd\x00V\xd4' + '\xc4a\x87z\xed\xb0-\x1a\xb3\xb8\x95\xbdf8\x1e\x11\xca,MoC$\x15\x18{' + '\x006}m\x13\x16\x1a\x1f\x83\x85}6\x17\x1b $\x83\x00\x86\x19\x1d!%)\x8c' + '\x866#\'+.\x8ca`\x1c`(,/1\x94B5\x19\x1e"&*-024\xacNq\xba\xbb\xb8h\xbeb' + '\x00A\x00;' +) + + def loadFile(name, size=0): """Load file from testing directory """ diff --git a/src/collective/cover/tests/test_basic_tile.py b/src/collective/cover/tests/test_basic_tile.py index cf92ef4e7..416fab611 100644 --- a/src/collective/cover/tests/test_basic_tile.py +++ b/src/collective/cover/tests/test_basic_tile.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- from collective.cover.testing import ALL_CONTENT_TYPES -from collective.cover.config import PLONE_VERSION from collective.cover.testing import generate_jpeg from collective.cover.testing import images_are_equal from collective.cover.tests.base import TestTileMixin @@ -230,11 +229,10 @@ def test_basic_tile_image(self): self.assertIn('test/@@images', rendered) - @unittest.skipIf(PLONE_VERSION < '4.3', 'zptlogo not available') def test_double_assign_tile_dexterity_image(self): # https://github.com/collective/collective.cover/issues/449 + from collective.cover.testing import zptlogo from plone.namedfile.file import NamedBlobImage - from plone.namedfile.tests.test_image import zptlogo with api.env.adopt_roles(['Manager']): obj = api.content.create(self.portal, 'Dexterity Image', 'foo') obj.image = NamedBlobImage(zptlogo) diff --git a/src/collective/cover/tests/test_carousel_tile.py b/src/collective/cover/tests/test_carousel_tile.py index e25f618c3..d350448c2 100644 --- a/src/collective/cover/tests/test_carousel_tile.py +++ b/src/collective/cover/tests/test_carousel_tile.py @@ -12,27 +12,6 @@ import unittest -zptlogo = ( - 'GIF89a\x10\x00\x10\x00\xd5\x00\x00\xff\xff\xff\xff\xff\xfe\xfc\xfd\xfd' - '\xfa\xfb\xfc\xf7\xf9\xfa\xf5\xf8\xf9\xf3\xf6\xf8\xf2\xf5\xf7\xf0\xf4\xf6' - '\xeb\xf1\xf3\xe5\xed\xef\xde\xe8\xeb\xdc\xe6\xea\xd9\xe4\xe8\xd7\xe2\xe6' - '\xd2\xdf\xe3\xd0\xdd\xe3\xcd\xdc\xe1\xcb\xda\xdf\xc9\xd9\xdf\xc8\xd8\xdd' - '\xc6\xd7\xdc\xc4\xd6\xdc\xc3\xd4\xda\xc2\xd3\xd9\xc1\xd3\xd9\xc0\xd2\xd9' - '\xbd\xd1\xd8\xbd\xd0\xd7\xbc\xcf\xd7\xbb\xcf\xd6\xbb\xce\xd5\xb9\xcd\xd4' - '\xb6\xcc\xd4\xb6\xcb\xd3\xb5\xcb\xd2\xb4\xca\xd1\xb2\xc8\xd0\xb1\xc7\xd0' - '\xb0\xc7\xcf\xaf\xc6\xce\xae\xc4\xce\xad\xc4\xcd\xab\xc3\xcc\xa9\xc2\xcb' - '\xa8\xc1\xca\xa6\xc0\xc9\xa4\xbe\xc8\xa2\xbd\xc7\xa0\xbb\xc5\x9e\xba\xc4' - '\x9b\xbf\xcc\x98\xb6\xc1\x8d\xae\xbaFgs\x00\x00\x00\x00\x00\x00\x00\x00' - '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' - '\x00,\x00\x00\x00\x00\x10\x00\x10\x00\x00\x06z@\x80pH,\x12k\xc8$\xd2f\x04' - '\xd4\x84\x01\x01\xe1\xf0d\x16\x9f\x80A\x01\x91\xc0ZmL\xb0\xcd\x00V\xd4' - '\xc4a\x87z\xed\xb0-\x1a\xb3\xb8\x95\xbdf8\x1e\x11\xca,MoC$\x15\x18{' - '\x006}m\x13\x16\x1a\x1f\x83\x85}6\x17\x1b $\x83\x00\x86\x19\x1d!%)\x8c' - '\x866#\'+.\x8ca`\x1c`(,/1\x94B5\x19\x1e"&*-024\xacNq\xba\xbb\xb8h\xbeb' - '\x00A\x00;' -) - - class CarouselTileTestCase(TestTileMixin, unittest.TestCase): def setUp(self): @@ -256,14 +235,15 @@ def test_get_alt(self): self.assertIn( 'alt="This image was created for testing purposes"', rendered) - def test_populate_collection(self): + def test_populate_with_collection(self): + from collective.cover.testing import zptlogo with api.env.adopt_roles(['Manager']): api.content.create( self.portal, 'News Item', id='new1', image=zptlogo) api.content.create( self.portal, 'News Item', id='new2', image=zptlogo) - api.content.create( - self.portal, 'News Item', id='new3') + api.content.create(self.portal, 'News Item', id='new3') + query = [dict( i='portal_type', o='plone.app.querystring.operation.selection.is', @@ -271,7 +251,7 @@ def test_populate_collection(self): )] col = api.content.create( self.portal, 'Collection', 'collection', query=query) - api.content.transition(col, 'publish') + self.tile.populate_with_object(col) rendered = self.tile() self.assertIn(u' Date: Tue, 1 Mar 2016 15:50:28 -0300 Subject: [PATCH 2/3] Simplify README format --- README.rst | 56 +++++++++++++++++------------------------------------- 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/README.rst b/README.rst index a99c81264..c6a0052e2 100644 --- a/README.rst +++ b/README.rst @@ -14,20 +14,16 @@ offer. However, despite offering rich resources to build a cover, ``collective.cover`` also provides a very easy mechanism for managing its contents, built around a drag-and-drop interface. -``collective.cover`` is based on `Blocks`_ and `Tiles`_, like `Mosaic`_, the new layout solution for Plone. - -.. _`Blocks`: https://pypi.python.org/pypi/plone.app.blocks -.. _`Mosaic`: https://pypi.python.org/pypi/plone.app.mosaic -.. _`Tiles`: https://pypi.python.org/pypi/plone.app.tiles +``collective.cover`` is based on `Blocks `_ and `Tiles `_, +like `Mosaic `_, +the new layout solution for Plone. Demo ^^^^ -For impatient types, there is a demo installation of collective.cover on `Heroku`_. +For impatient types, there is a demo installation of collective.cover on `Heroku `_. It needs about 60 seconds to spin up and it will purge all changes after about an hour of non-usage. -.. _`Heroku`: http://collective-cover.herokuapp.com - Use cases ^^^^^^^^^ @@ -83,39 +79,29 @@ Mostly Harmless .. image:: https://img.shields.io/coveralls/collective/collective.cover/master.svg :target: https://coveralls.io/r/collective/collective.cover -Got an idea? Found a bug? Let us know by `opening a support ticket`_. - -.. _`opening a support ticket`: https://github.com/collective/collective.cover/issues +Got an idea? Found a bug? Let us know by `opening a support ticket `_. Known issues ^^^^^^^^^^^^ -* `Versioning creates zillions of empty blob files`_. +* `Versioning creates zillions of empty blob files `_. If you're using this feature in your site you have to take special attention to the number of free inodes in your file system, as you can run out of them; use the ``df -i`` command to check it. -* `Package is not compatible with standard Plone tiles`_. +* `Package is not compatible with standard Plone tiles `_. This will be addressed in a future release, if we get an sponsor. -See the `complete list of bugs on GitHub`_. - -.. _`Versioning creates zillions of empty blob files`: https://github.com/collective/collective.cover/issues/532 -.. _`Package is not compatible with standard Plone tiles`: https://github.com/collective/collective.cover/issues/81 -.. _`complete list of bugs on GitHub`: https://github.com/collective/collective.cover/issues?labels=bug&milestone=&page=1&state=open +See the `complete list of bugs on GitHub `_. Don't Panic ----------- We are currently working on the documentation of the package; this is what we have right now (contributions are always welcomed): -* `Quick Tour video on YouTube`_. -* `End user documentation`_ -* `Developer documentation`_ - -.. _`Developer documentation`: https://github.com/collective/collective.cover/blob/master/docs/developer.rst -.. _`End user documentation`: https://github.com/collective/collective.cover/blob/master/docs/end-user.rst -.. _`Quick Tour video on YouTube`: https://www.youtube.com/watch?v=h_rsSL1e4i4 +* `Quick Tour video on YouTube `_. +* `End user documentation `_ +* `Developer documentation `_ Installation ^^^^^^^^^^^^ @@ -176,40 +162,32 @@ Over the years there have been some packages designed to solve the problem of creating section covers in Plone. We have used and have taken ideas from the following: -`CompositePack`_ +`CompositePack `_ Very old; the legacy code is so complex that is not maintainable anymore. It has (arguably) the best user interface of all. Layouts can not be created TTW. Viewlets are just page templates associated with content types; you can drag&drop viewlets around the layout. Publishers love it. -`CMFContentPanels`_ +`CMFContentPanels `_ Code is very old, but still maintained (at least works in Plone 4). Allows to create complex layouts TTW and use any layout as a template. Easy to extend and edit (but is terrible to find a content to use). Needs a lot of memory to work and aggressive cache settings. -`Collage`_ +`Collage `_ Allows the creation of layouts TTW but it has (arguably) the worst user interface of all. It is easily extended and there are several add-ons available that provide new functionality for it. -`Home Page Editor of the Brazilian Chamber of Deputies Site`_ - Strongly based on `Collage`_, this package was presented at the `World Plone Day 2012 Brasilia`_. +`Home Page Editor of the Brazilian Chamber of Deputies Site `_ + Strongly based on `Collage`_, this package was presented at the `World Plone Day 2012 Brasilia `_. It allows editing of home pages and the definition of permissions on blocks of content. Works under Plone 3 only. -`collective.panels`_ +`collective.panels `_ A new package that lets site editors add portlets to a set of new locations: above and below page contents, portal top and footer. The package comes with a number of flexible layouts that are used to position the portlets, and locations can be fixed to the nearest site object, to facilitate inheritance. In ``collective.cover`` (this package), we don't want to use portlets at all. - -.. _`CMFContentPanels`: http://plone.org/products/cmfcontentpanels -.. _`Collage`: http://plone.org/products/collage -.. _`collective.panels`: https://github.com/collective/collective.panels -.. _`CompositePack`: http://plone.org/products/compositepack -.. _`Home Page Editor of the Brazilian Chamber of Deputies Site`: https://colab.interlegis.leg.br/browser/publico/camara.home -.. _`Using tiles to provide more flexible Plone layouts`: http://davisagli.com/blog/using-tiles-to-provide-more-flexible-plone-layouts -.. _`World Plone Day 2012 Brasilia`: http://colab.interlegis.leg.br/wiki/WorldPloneDay From 06ee04093c5d897958f18b88df543a9673357ea2 Mon Sep 17 00:00:00 2001 From: hvelarde Date: Tue, 1 Mar 2016 15:51:15 -0300 Subject: [PATCH 3/3] Explicitly mark Plone 5 as not supported --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 48855ca9b..05a61543c 100644 --- a/setup.py +++ b/setup.py @@ -82,7 +82,7 @@ 'plone.z3cform', 'Products.Archetypes', 'Products.CMFCore', - 'Products.CMFPlone >=4.2', + 'Products.CMFPlone >=4.2, <5.0', 'Products.GenericSetup', 'setuptools', 'z3c.caching',