Skip to content

Commit

Permalink
[fc] Repository: plone.app.testing
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2021-08-18T18:47:46+02:00
Author: Roel Bruggink (jaroel) <roel@jaroel.nl>
Commit: plone/plone.app.testing@50c1708

Dx siteroot (#60)

Fixed test that failed for dexterity site root.

Co-authored-by: ale-rt &lt;alessandro.pisa@gmail.com&gt;

Files changed:
M src/plone/app/testing/layers.rst
  • Loading branch information
mauritsvanrees committed Aug 18, 2021
1 parent 1abcb37 commit a9a5f5c
Showing 1 changed file with 10 additions and 54 deletions.
64 changes: 10 additions & 54 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,63 +1,19 @@
Repository: plone.app.multilingual
Repository: plone.app.testing


Branch: refs/heads/master
Date: 2021-07-30T16:35:41+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: https://github.com/plone/plone.app.multilingual/commit/a4a281cffe920d566e16b19a326e3051f2194592
Date: 2021-08-18T18:47:46+02:00
Author: Roel Bruggink (jaroel) <roel@jaroel.nl>
Commit: https://github.com/plone/plone.app.testing/commit/50c1708ccd3320ba505f8c2ad19edcd96847ea26

fix issue when deleting items with broken relation in languageindependent field
Dx siteroot (#60)

Files changed:
M src/plone/app/multilingual/dx/cloner.py

b'diff --git a/src/plone/app/multilingual/dx/cloner.py b/src/plone/app/multilingual/dx/cloner.py\nindex f5c489e9..d18452f8 100644\n--- a/src/plone/app/multilingual/dx/cloner.py\n+++ b/src/plone/app/multilingual/dx/cloner.py\n@@ -49,6 +49,9 @@ def has_independent_fields(self):\n return False\n \n def copy_relation(self, relation_value, target_language):\n+ if not relation_value or relation_value.isBroken():\n+ return\n+\n obj = relation_value.to_object\n intids = getUtility(IIntIds)\n translation = ITranslationManager(obj).get_translation(target_language)\n@@ -62,20 +65,21 @@ def copy_fields(self, translation):\n \n target_language = queryAdapter(translation, ILanguage).get_language()\n \n- def relation_copier(rel, lang=target_language, fun=self.copy_relation):\n- return fun(rel, lang)\n-\n for schema in iterSchemata(self.context):\n for field_name in schema:\n if ILanguageIndependentField.providedBy(schema[field_name]):\n value = getattr(schema(self.context), field_name, _marker)\n-\n if value == _marker:\n continue\n elif IRelationValue.providedBy(value):\n value = self.copy_relation(value, target_language)\n elif IRelationList.providedBy(schema[field_name]):\n- value = list(map(relation_copier, value or []))\n+ new_value = []\n+ for relation in value:\n+ copied_relation = self.copy_relation(relation, target_language)\n+ if copied_relation:\n+ new_value.append(copied_relation)\n+ value = new_value\n \n doomed = True\n setattr(schema(translation),\n'

Repository: plone.app.multilingual


Branch: refs/heads/master
Date: 2021-07-30T16:37:17+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: https://github.com/plone/plone.app.multilingual/commit/ece956d70898780e0645aac166f6e1d40ae596cd

update changelog

Files changed:
A news/390.bugfix

b'diff --git a/news/390.bugfix b/news/390.bugfix\nnew file mode 100644\nindex 00000000..ad69426b\n--- /dev/null\n+++ b/news/390.bugfix\n@@ -0,0 +1,2 @@\n+Fix deleting items with broken relation in languageindependent field\n+[pbauer]\n\\ No newline at end of file\n'

Repository: plone.app.multilingual


Branch: refs/heads/master
Date: 2021-08-17T23:48:53+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: https://github.com/plone/plone.app.multilingual/commit/ebf2c387e20cdaf28326c56828b6054bf04dadba

fix testcase where relation is None. readability sucks now.

Files changed:
M src/plone/app/multilingual/dx/cloner.py

b'diff --git a/src/plone/app/multilingual/dx/cloner.py b/src/plone/app/multilingual/dx/cloner.py\nindex d18452f8..c4221e3f 100644\n--- a/src/plone/app/multilingual/dx/cloner.py\n+++ b/src/plone/app/multilingual/dx/cloner.py\n@@ -74,12 +74,15 @@ def copy_fields(self, translation):\n elif IRelationValue.providedBy(value):\n value = self.copy_relation(value, target_language)\n elif IRelationList.providedBy(schema[field_name]):\n- new_value = []\n- for relation in value:\n- copied_relation = self.copy_relation(relation, target_language)\n- if copied_relation:\n- new_value.append(copied_relation)\n- value = new_value\n+ if not value:\n+ value = []\n+ else:\n+ new_value = []\n+ for relation in value:\n+ copied_relation = self.copy_relation(relation, target_language)\n+ if copied_relation:\n+ new_value.append(copied_relation)\n+ value = new_value\n \n doomed = True\n setattr(schema(translation),\n'

Repository: plone.app.multilingual


Branch: refs/heads/master
Date: 2021-08-18T07:51:25+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: https://github.com/plone/plone.app.multilingual/commit/1cf52970c08105cbe39c64adbb3c0ac65dc6659c

Merge pull request #390 from plone/fix_copier_with_broken_relations

fix deleting items with broken relation in languageindependent field
Fixed test that failed for dexterity site root.

Co-authored-by: ale-rt &lt;alessandro.pisa@gmail.com&gt;

Files changed:
A news/390.bugfix
M src/plone/app/multilingual/dx/cloner.py
M src/plone/app/testing/layers.rst

b'diff --git a/news/390.bugfix b/news/390.bugfix\nnew file mode 100644\nindex 00000000..ad69426b\n--- /dev/null\n+++ b/news/390.bugfix\n@@ -0,0 +1,2 @@\n+Fix deleting items with broken relation in languageindependent field\n+[pbauer]\n\\ No newline at end of file\ndiff --git a/src/plone/app/multilingual/dx/cloner.py b/src/plone/app/multilingual/dx/cloner.py\nindex f5c489e9..c4221e3f 100644\n--- a/src/plone/app/multilingual/dx/cloner.py\n+++ b/src/plone/app/multilingual/dx/cloner.py\n@@ -49,6 +49,9 @@ def has_independent_fields(self):\n return False\n \n def copy_relation(self, relation_value, target_language):\n+ if not relation_value or relation_value.isBroken():\n+ return\n+\n obj = relation_value.to_object\n intids = getUtility(IIntIds)\n translation = ITranslationManager(obj).get_translation(target_language)\n@@ -62,20 +65,24 @@ def copy_fields(self, translation):\n \n target_language = queryAdapter(translation, ILanguage).get_language()\n \n- def relation_copier(rel, lang=target_language, fun=self.copy_relation):\n- return fun(rel, lang)\n-\n for schema in iterSchemata(self.context):\n for field_name in schema:\n if ILanguageIndependentField.providedBy(schema[field_name]):\n value = getattr(schema(self.context), field_name, _marker)\n-\n if value == _marker:\n continue\n elif IRelationValue.providedBy(value):\n value = self.copy_relation(value, target_language)\n elif IRelationList.providedBy(schema[field_name]):\n- value = list(map(relation_copier, value or []))\n+ if not value:\n+ value = []\n+ else:\n+ new_value = []\n+ for relation in value:\n+ copied_relation = self.copy_relation(relation, target_language)\n+ if copied_relation:\n+ new_value.append(copied_relation)\n+ value = new_value\n \n doomed = True\n setattr(schema(translation),\n'
b'diff --git a/src/plone/app/testing/layers.rst b/src/plone/app/testing/layers.rst\nindex 89656f1..6cf1ca7 100644\n--- a/src/plone/app/testing/layers.rst\n+++ b/src/plone/app/testing/layers.rst\n@@ -338,7 +338,7 @@ We can now look for this new object through the server.\n [\'http\', \'//localhost\']\n \n >>> from six.moves.urllib.request import urlopen\n- >>> conn = urlopen(portal_url + \'/Title\', timeout=10)\n+ >>> conn = urlopen(portal_url, timeout=10)\n >>> responseBody = conn.read()\n >>> b"Fancy Portal" in responseBody\n True\n'

0 comments on commit a9a5f5c

Please sign in to comment.