Skip to content

Commit

Permalink
[fc] Repository: plone.api
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2018-09-06T09:18:52+02:00
Author: Gauthier Bastien (gbastien) <g.bastien@imio.be>
Commit: plone/plone.api@2fa3b01

Fix falining AT Collection creation when using api.content.create.

Files changed:
M CHANGES.rst
M src/plone/api/content.py
M src/plone/api/tests/test_content.py
Repository: plone.api

Branch: refs/heads/master
Date: 2018-09-06T09:44:06+02:00
Author: Gauthier Bastien (gbastien) <g.bastien@imio.be>
Commit: plone/plone.api@ddeeac3

Fix flake8

Files changed:
M src/plone/api/tests/test_content.py
Repository: plone.api

Branch: refs/heads/master
Date: 2018-09-06T14:38:42+02:00
Author: Gauthier Bastien (gbastien) <g.bastien@imio.be>
Commit: plone/plone.api@81fef76

Typo

Files changed:
M CHANGES.rst
Repository: plone.api

Branch: refs/heads/master
Date: 2018-09-06T14:38:55+02:00
Author: Gauthier Bastien (gbastien) <g.bastien@imio.be>
Commit: plone/plone.api@31119fe

Run test create Collection in both AT and DX env

Files changed:
M src/plone/api/tests/test_content.py
Repository: plone.api

Branch: refs/heads/master
Date: 2018-09-06T20:56:53+02:00
Author: Gauthier Bastien (gbastien) <gauthier@imio.be>
Commit: plone/plone.api@bac3db8

Removed reference to plone/plone.app.contenttypes#465

Files changed:
M src/plone/api/tests/test_content.py
Repository: plone.api

Branch: refs/heads/master
Date: 2018-09-06T22:24:11+02:00
Author: Gauthier Bastien (gbastien) <gauthier@imio.be>
Commit: plone/plone.api@d491d6a

Completed docstring for test_create_dx_event

Files changed:
M src/plone/api/tests/test_content.py
Repository: plone.api

Branch: refs/heads/master
Date: 2018-09-14T09:15:25+02:00
Author: Gil Forcada Codinachs (gforcada) <gil.gnome@gmail.com>
Commit: plone/plone.api@3e38c4f

Merge pull request #414 from plone/create_at_collection_fix

Fix falining AT Collection creation when using api.content.create.

Files changed:
M CHANGES.rst
M src/plone/api/content.py
M src/plone/api/tests/test_content.py
  • Loading branch information
gforcada committed Sep 14, 2018
1 parent 754828f commit 3959297
Showing 1 changed file with 92 additions and 15 deletions.
107 changes: 92 additions & 15 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,111 @@
Repository: plone.app.multilingual
Repository: plone.api


Branch: refs/heads/master
Date: 2018-09-04T11:57:59+02:00
Author: Tom Gross (tomgross) <itconsense@gmail.com>
Commit: https://github.com/plone/plone.app.multilingual/commit/701df20a49e051f24dddc72631cd32e583766128
Date: 2018-09-06T09:18:52+02:00
Author: Gauthier Bastien (gbastien) <g.bastien@imio.be>
Commit: https://github.com/plone/plone.api/commit/2fa3b01a43a56c4dfa57ce8d4488a5abc6430d90

Make multilingual selector more failsafe
Fix falining AT Collection creation when using api.content.create.

Files changed:
M CHANGES.rst
M src/plone/app/multilingual/browser/helper_views.py
M src/plone/api/content.py
M src/plone/api/tests/test_content.py

b"diff --git a/CHANGES.rst b/CHANGES.rst\nindex 631caa3a..6801d993 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -25,6 +25,8 @@ Bug fixes:\n - Fixed tests now that Catalan has translated 'assets' into 'recursos'.\n [maurits]\n \n+- Don't fail, if multilingual selector is called without query\n+ [tomgross]\n \n 5.2.0 (2018-04-04)\n ------------------\ndiff --git a/src/plone/app/multilingual/browser/helper_views.py b/src/plone/app/multilingual/browser/helper_views.py\nindex f36a925f..a1e75bb1 100644\n--- a/src/plone/app/multilingual/browser/helper_views.py\n+++ b/src/plone/app/multilingual/browser/helper_views.py\n@@ -154,9 +154,11 @@ def getClosestDestination(self):\n \n # We are using TranslationManager to get the translations of a\n # string tg\n- manager = TranslationManager(self.tg)\n- context = None\n- languages = manager.get_translations()\n+ try:\n+ manager = TranslationManager(self.tg)\n+ languages = manager.get_translations()\n+ except AttributeError:\n+ languages = []\n if len(languages) == 0:\n # If there is no results there are no translations\n # we move to portal root\n"
b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex 5c80d6b..d9243a4 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -21,6 +21,9 @@ Bug fixes:\n - fix typos in doc strings\n [tkimnguyen]\n \n+- Fix falining AT Collection creation when using api.content.create.\n+ [gbastien]\n+\n \n 1.8.4 (2018-04-24)\n ------------------\ndiff --git a/src/plone/api/content.py b/src/plone/api/content.py\nindex a088554..5ec0605 100644\n--- a/src/plone/api/content.py\n+++ b/src/plone/api/content.py\n@@ -112,8 +112,8 @@ def create(\n # rename-after-creation and such\n # Passing values as a dict with None values so values set by\n # invokeFactory don\'t get overridden.\n- # None: None is required so that bool(values) is True.\n- content.processForm(values={None: None})\n+ # \'\': \'\' is required so that bool(values) is True.\n+ content.processForm(values={\'\': \'\'})\n \n if not id or (safe_id and id):\n # Create a new id from title\ndiff --git a/src/plone/api/tests/test_content.py b/src/plone/api/tests/test_content.py\nindex 18546ba..1033cf6 100644\n--- a/src/plone/api/tests/test_content.py\n+++ b/src/plone/api/tests/test_content.py\n@@ -376,6 +376,62 @@ def test_create_at_with_title_in_request(self):\n \n self.assertEqual(page.title, \'Test document\')\n \n+ @unittest.skipIf(HAS_PACONTENTYPES, \'Archetypes only\')\n+ def test_create_at_collection(self):\n+ """Test create at Collecition."""\n+ collection = api.content.create(\n+ container=self.portal,\n+ type=\'Collection\',\n+ title=\'Mandelbrot set\',\n+ description=\'Image gallery of a zoom sequence\',\n+ query=[{\n+ \'i\': \'Type\',\n+ \'o\': \'plone.app.querystring.operation.string.is\',\n+ \'v\': [\'Image\'],\n+ }],\n+ )\n+ self.assertEqual(collection.Title(), \'Mandelbrot set\')\n+\n+ @unittest.skipIf(HAS_PACONTENTYPES, \'Archetypes only\')\n+ def test_create_at_event(self):\n+ """https://github.com/plone/plone.api/issues/364"""\n+ from DateTime import DateTime\n+ today = DateTime()\n+ tomorrow = today + 1\n+ event = api.content.create(\n+ container=self.portal,\n+ type=\'Event\',\n+ title=u\'My event\',\n+ startDate=today,\n+ endDate=tomorrow,\n+ )\n+ self.assertEqual(event.startDate, today)\n+ self.assertEqual(event.endDate, tomorrow)\n+ results = api.content.find(Title=u\'My event\')\n+ self.assertEqual(len(results), 1)\n+ self.assertEqual(results[0].start, today)\n+ self.assertEqual(results[0].end, tomorrow)\n+\n+ @unittest.skipUnless(HAS_PACONTENTYPES, \'Dexterity only\')\n+ def test_create_dx_event(self):\n+ """https://github.com/plone/plone.app.contenttypes/issues/465"""\n+ import datetime\n+ today = datetime.datetime.now()\n+ tomorrow = today + datetime.timedelta(days=1)\n+ event = api.content.create(\n+ container=self.portal,\n+ type=\'Event\',\n+ title=u\'My event\',\n+ start=today,\n+ end=tomorrow,\n+ )\n+ self.assertEqual(event.start, today)\n+ self.assertEqual(event.end, tomorrow)\n+ results = api.content.find(Title=u\'My event\')\n+ self.assertEqual(len(results), 1)\n+ self.assertEqual(results[0].start, today)\n+ self.assertEqual(results[0].end, tomorrow)\n+\n def test_get_constraints(self):\n """Test the constraints when content is fetched with get."""\n \n'

Repository: plone.app.multilingual
Repository: plone.api


Branch: refs/heads/master
Date: 2018-09-10T08:50:56+02:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: https://github.com/plone/plone.app.multilingual/commit/7cb4e7154495b243f9981a7f58a6301c85c70cff
Date: 2018-09-06T09:44:06+02:00
Author: Gauthier Bastien (gbastien) <g.bastien@imio.be>
Commit: https://github.com/plone/plone.api/commit/ddeeac3bd1ebbbc75b4e397ed699fbe472df4b51

Merge pull request #322 from plone/selector_failsafe
Fix flake8

Make multilingual selector more failsafe
Files changed:
M src/plone/api/tests/test_content.py

b"diff --git a/src/plone/api/tests/test_content.py b/src/plone/api/tests/test_content.py\nindex 1033cf6..f08285a 100644\n--- a/src/plone/api/tests/test_content.py\n+++ b/src/plone/api/tests/test_content.py\n@@ -384,11 +384,13 @@ def test_create_at_collection(self):\n type='Collection',\n title='Mandelbrot set',\n description='Image gallery of a zoom sequence',\n- query=[{\n- 'i': 'Type',\n- 'o': 'plone.app.querystring.operation.string.is',\n- 'v': ['Image'],\n- }],\n+ query=[\n+ {\n+ 'i': 'Type',\n+ 'o': 'plone.app.querystring.operation.string.is',\n+ 'v': ['Image'],\n+ },\n+ ],\n )\n self.assertEqual(collection.Title(), 'Mandelbrot set')\n \n"

Repository: plone.api


Branch: refs/heads/master
Date: 2018-09-06T14:38:42+02:00
Author: Gauthier Bastien (gbastien) <g.bastien@imio.be>
Commit: https://github.com/plone/plone.api/commit/81fef76ad55f02c3e374d1d68efd9d5657149a80

Typo

Files changed:
M CHANGES.rst

b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex d9243a4..7d26905 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -21,7 +21,7 @@ Bug fixes:\n - fix typos in doc strings\n [tkimnguyen]\n \n-- Fix falining AT Collection creation when using api.content.create.\n+- Fix failing AT Collection creation when using api.content.create.\n [gbastien]\n \n \n'

Repository: plone.api


Branch: refs/heads/master
Date: 2018-09-06T14:38:55+02:00
Author: Gauthier Bastien (gbastien) <g.bastien@imio.be>
Commit: https://github.com/plone/plone.api/commit/31119fe0fdc9977b9a4dc261471bf159589b38d1

Run test create Collection in both AT and DX env

Files changed:
M src/plone/api/tests/test_content.py

b'diff --git a/src/plone/api/tests/test_content.py b/src/plone/api/tests/test_content.py\nindex f08285a..8a07768 100644\n--- a/src/plone/api/tests/test_content.py\n+++ b/src/plone/api/tests/test_content.py\n@@ -376,9 +376,8 @@ def test_create_at_with_title_in_request(self):\n \n self.assertEqual(page.title, \'Test document\')\n \n- @unittest.skipIf(HAS_PACONTENTYPES, \'Archetypes only\')\n- def test_create_at_collection(self):\n- """Test create at Collecition."""\n+ def test_create_collection(self):\n+ """Test create a Collection."""\n collection = api.content.create(\n container=self.portal,\n type=\'Collection\',\n'

Repository: plone.api


Branch: refs/heads/master
Date: 2018-09-06T20:56:53+02:00
Author: Gauthier Bastien (gbastien) <gauthier@imio.be>
Commit: https://github.com/plone/plone.api/commit/bac3db8816e5b419d6ca5015f34890792d76f927

Removed reference to https://github.com/plone/plone.app.contenttypes/issues/465

Files changed:
M src/plone/api/tests/test_content.py

b'diff --git a/src/plone/api/tests/test_content.py b/src/plone/api/tests/test_content.py\nindex 8a07768..98a918f 100644\n--- a/src/plone/api/tests/test_content.py\n+++ b/src/plone/api/tests/test_content.py\n@@ -415,7 +415,7 @@ def test_create_at_event(self):\n \n @unittest.skipUnless(HAS_PACONTENTYPES, \'Dexterity only\')\n def test_create_dx_event(self):\n- """https://github.com/plone/plone.app.contenttypes/issues/465"""\n+ """ """\n import datetime\n today = datetime.datetime.now()\n tomorrow = today + datetime.timedelta(days=1)\n'

Repository: plone.api


Branch: refs/heads/master
Date: 2018-09-06T22:24:11+02:00
Author: Gauthier Bastien (gbastien) <gauthier@imio.be>
Commit: https://github.com/plone/plone.api/commit/d491d6a6861bceda5b20ad0db71906c48d91465f

Completed docstring for test_create_dx_event

Files changed:
M src/plone/api/tests/test_content.py

b'diff --git a/src/plone/api/tests/test_content.py b/src/plone/api/tests/test_content.py\nindex 98a918f..84c69e6 100644\n--- a/src/plone/api/tests/test_content.py\n+++ b/src/plone/api/tests/test_content.py\n@@ -415,7 +415,7 @@ def test_create_at_event(self):\n \n @unittest.skipUnless(HAS_PACONTENTYPES, \'Dexterity only\')\n def test_create_dx_event(self):\n- """ """\n+ """Test create a DX event."""\n import datetime\n today = datetime.datetime.now()\n tomorrow = today + datetime.timedelta(days=1)\n'

Repository: plone.api


Branch: refs/heads/master
Date: 2018-09-14T09:15:25+02:00
Author: Gil Forcada Codinachs (gforcada) <gil.gnome@gmail.com>
Commit: https://github.com/plone/plone.api/commit/3e38c4fc0c09b10eb80637175fe653f883ec803c

Merge pull request #414 from plone/create_at_collection_fix

Fix falining AT Collection creation when using api.content.create.

Files changed:
M CHANGES.rst
M src/plone/app/multilingual/browser/helper_views.py
M src/plone/api/content.py
M src/plone/api/tests/test_content.py

b"diff --git a/CHANGES.rst b/CHANGES.rst\nindex 631caa3a..6801d993 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -25,6 +25,8 @@ Bug fixes:\n - Fixed tests now that Catalan has translated 'assets' into 'recursos'.\n [maurits]\n \n+- Don't fail, if multilingual selector is called without query\n+ [tomgross]\n \n 5.2.0 (2018-04-04)\n ------------------\ndiff --git a/src/plone/app/multilingual/browser/helper_views.py b/src/plone/app/multilingual/browser/helper_views.py\nindex f36a925f..a1e75bb1 100644\n--- a/src/plone/app/multilingual/browser/helper_views.py\n+++ b/src/plone/app/multilingual/browser/helper_views.py\n@@ -154,9 +154,11 @@ def getClosestDestination(self):\n \n # We are using TranslationManager to get the translations of a\n # string tg\n- manager = TranslationManager(self.tg)\n- context = None\n- languages = manager.get_translations()\n+ try:\n+ manager = TranslationManager(self.tg)\n+ languages = manager.get_translations()\n+ except AttributeError:\n+ languages = []\n if len(languages) == 0:\n # If there is no results there are no translations\n # we move to portal root\n"
b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex 5c80d6b..7d26905 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -21,6 +21,9 @@ Bug fixes:\n - fix typos in doc strings\n [tkimnguyen]\n \n+- Fix failing AT Collection creation when using api.content.create.\n+ [gbastien]\n+\n \n 1.8.4 (2018-04-24)\n ------------------\ndiff --git a/src/plone/api/content.py b/src/plone/api/content.py\nindex a088554..5ec0605 100644\n--- a/src/plone/api/content.py\n+++ b/src/plone/api/content.py\n@@ -112,8 +112,8 @@ def create(\n # rename-after-creation and such\n # Passing values as a dict with None values so values set by\n # invokeFactory don\'t get overridden.\n- # None: None is required so that bool(values) is True.\n- content.processForm(values={None: None})\n+ # \'\': \'\' is required so that bool(values) is True.\n+ content.processForm(values={\'\': \'\'})\n \n if not id or (safe_id and id):\n # Create a new id from title\ndiff --git a/src/plone/api/tests/test_content.py b/src/plone/api/tests/test_content.py\nindex 18546ba..84c69e6 100644\n--- a/src/plone/api/tests/test_content.py\n+++ b/src/plone/api/tests/test_content.py\n@@ -376,6 +376,63 @@ def test_create_at_with_title_in_request(self):\n \n self.assertEqual(page.title, \'Test document\')\n \n+ def test_create_collection(self):\n+ """Test create a Collection."""\n+ collection = api.content.create(\n+ container=self.portal,\n+ type=\'Collection\',\n+ title=\'Mandelbrot set\',\n+ description=\'Image gallery of a zoom sequence\',\n+ query=[\n+ {\n+ \'i\': \'Type\',\n+ \'o\': \'plone.app.querystring.operation.string.is\',\n+ \'v\': [\'Image\'],\n+ },\n+ ],\n+ )\n+ self.assertEqual(collection.Title(), \'Mandelbrot set\')\n+\n+ @unittest.skipIf(HAS_PACONTENTYPES, \'Archetypes only\')\n+ def test_create_at_event(self):\n+ """https://github.com/plone/plone.api/issues/364"""\n+ from DateTime import DateTime\n+ today = DateTime()\n+ tomorrow = today + 1\n+ event = api.content.create(\n+ container=self.portal,\n+ type=\'Event\',\n+ title=u\'My event\',\n+ startDate=today,\n+ endDate=tomorrow,\n+ )\n+ self.assertEqual(event.startDate, today)\n+ self.assertEqual(event.endDate, tomorrow)\n+ results = api.content.find(Title=u\'My event\')\n+ self.assertEqual(len(results), 1)\n+ self.assertEqual(results[0].start, today)\n+ self.assertEqual(results[0].end, tomorrow)\n+\n+ @unittest.skipUnless(HAS_PACONTENTYPES, \'Dexterity only\')\n+ def test_create_dx_event(self):\n+ """Test create a DX event."""\n+ import datetime\n+ today = datetime.datetime.now()\n+ tomorrow = today + datetime.timedelta(days=1)\n+ event = api.content.create(\n+ container=self.portal,\n+ type=\'Event\',\n+ title=u\'My event\',\n+ start=today,\n+ end=tomorrow,\n+ )\n+ self.assertEqual(event.start, today)\n+ self.assertEqual(event.end, tomorrow)\n+ results = api.content.find(Title=u\'My event\')\n+ self.assertEqual(len(results), 1)\n+ self.assertEqual(results[0].start, today)\n+ self.assertEqual(results[0].end, tomorrow)\n+\n def test_get_constraints(self):\n """Test the constraints when content is fetched with get."""\n \n'

0 comments on commit 3959297

Please sign in to comment.