Skip to content

Commit

Permalink
[fc] Repository: plone.rest
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2021-02-10T15:49:52+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.rest@8d1ed68

Explicitly make allow_credentials required in CORS policy.

This was the default for Bool fields until and including zope.schema 6.0.1.
In 6.1.0 this changed.
Since we have a default in the field definition, it does not look like any changes are needed for people using `plone.rest`.

Without this, we get errors like this on Jenkins with Plone coredev 6:

```
$ bin/test -s plone.rest
...
  File "/Users/maurits/shared-eggs/cp38/zope.configuration-4.4.0-py3.8.egg
/zope/configuration/config.py", line 869, in finish
    actions = self.handler(context, **args)
zope.configuration.xmlconfig.ZopeXMLConfigurationError:
File "/Users/maurits/community/plone-coredev/6.0/src/plone.rest/src/plone/rest/testing.zcml", line 163.2-167.6
    TypeError: cors_policy_directive() missing 1 required positional argument: 'allow_credentials'
```

See zopefoundation/zope.schema#104 (comment)

Files changed:
A news/104.bugfix
M src/plone/rest/zcml.py
Repository: plone.rest

Branch: refs/heads/master
Date: 2021-02-10T17:48:27+01:00
Author: Maurits van Rees (mauritsvanrees) <m.van.rees@zestsoftware.nl>
Commit: plone/plone.rest@cc8e7b3

Merge pull request #115 from plone/maurits/allow-credentials-required

Explicitly make allow_credentials required in CORS policy.

Files changed:
A news/104.bugfix
M src/plone/rest/zcml.py
  • Loading branch information
mauritsvanrees committed Feb 10, 2021
1 parent 67af02c commit 6352814
Showing 1 changed file with 32 additions and 30 deletions.
62 changes: 32 additions & 30 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,51 +1,53 @@
Repository: plone.app.versioningbehavior
Repository: plone.rest


Branch: refs/heads/master
Date: 2020-08-22T18:19:03+02:00
Author: Roel Bruggink (jaroel) <roel@jaroel.nl>
Commit: https://github.com/plone/plone.app.versioningbehavior/commit/a3c7ea1996e06c5eb6ea4cbca6368fe49bc8b3e0
Date: 2021-02-10T15:49:52+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: https://github.com/plone/plone.rest/commit/8d1ed68254ed2513b7bc02bee9dce71408d4f616

Check if we have portal_repository when creating the initial version.
Explicitly make allow_credentials required in CORS policy.

We don't have the required tooling ready when adding a Plone Site object
This was the default for Bool fields until and including zope.schema 6.0.1.
In 6.1.0 this changed.
Since we have a default in the field definition, it does not look like any changes are needed for people using `plone.rest`.

Files changed:
M plone/app/versioningbehavior/subscribers.py

b'diff --git a/plone/app/versioningbehavior/subscribers.py b/plone/app/versioningbehavior/subscribers.py\nindex fa195f0..9108b27 100644\n--- a/plone/app/versioningbehavior/subscribers.py\n+++ b/plone/app/versioningbehavior/subscribers.py\n@@ -70,7 +70,11 @@ def create_initial_version_after_adding(context, event):\n version. If a changeNote was entered it\'s used as comment.\n """\n \n- pr = getToolByName(context, \'portal_repository\')\n+ pr = getToolByName(context, \'portal_repository\', None)\n+ if pr is None:\n+ # This happens when adding a Plone Site with versioning.\n+ # The required tooling is not yet available.\n+ return\n if not pr.isVersionable(context):\n # object is not versionable\n return\n'

Repository: plone.app.versioningbehavior
Without this, we get errors like this on Jenkins with Plone coredev 6:

```
$ bin/test -s plone.rest
...
File "/Users/maurits/shared-eggs/cp38/zope.configuration-4.4.0-py3.8.egg
/zope/configuration/config.py", line 869, in finish
actions = self.handler(context, **args)
zope.configuration.xmlconfig.ZopeXMLConfigurationError:
File "/Users/maurits/community/plone-coredev/6.0/src/plone.rest/src/plone/rest/testing.zcml", line 163.2-167.6
TypeError: cors_policy_directive() missing 1 required positional argument: 'allow_credentials'
```

Branch: refs/heads/master
Date: 2021-02-10T12:21:29+01:00
Author: ale-rt (ale-rt) <alessandro.pisa@gmail.com>
Commit: https://github.com/plone/plone.app.versioningbehavior/commit/8dfc69f9620fb1143cda406f284d95710f9df574

Improve docs
See https://github.com/zopefoundation/zope.schema/issues/104#issuecomment-776747141

Files changed:
A news/53.bugfix
M plone/app/versioningbehavior/subscribers.py
A news/104.bugfix
M src/plone/rest/zcml.py

b"diff --git a/news/53.bugfix b/news/53.bugfix\nnew file mode 100644\nindex 0000000..21774c8\n--- /dev/null\n+++ b/news/53.bugfix\n@@ -0,0 +1 @@\n+Do not break if the portal_repository tool cannot be found\ndiff --git a/plone/app/versioningbehavior/subscribers.py b/plone/app/versioningbehavior/subscribers.py\nindex 9108b27..11859e7 100644\n--- a/plone/app/versioningbehavior/subscribers.py\n+++ b/plone/app/versioningbehavior/subscribers.py\n@@ -72,9 +72,10 @@ def create_initial_version_after_adding(context, event):\n \n pr = getToolByName(context, 'portal_repository', None)\n if pr is None:\n- # This happens when adding a Plone Site with versioning.\n- # The required tooling is not yet available.\n+ # This can happen, e.g., when adding a Plone Site with versioning\n+ # and portal_repository is not yet created\n return\n+\n if not pr.isVersionable(context):\n # object is not versionable\n return\n"
b'diff --git a/news/104.bugfix b/news/104.bugfix\nnew file mode 100644\nindex 0000000..28ba451\n--- /dev/null\n+++ b/news/104.bugfix\n@@ -0,0 +1,3 @@\n+Explicitly make ``allow_credentials`` required in CORS policy.\n+This was the default for Bool fields until and including zope.schema 6.0.1, but in 6.1.0 this changed.\n+[maurits]\ndiff --git a/src/plone/rest/zcml.py b/src/plone/rest/zcml.py\nindex b41521b..d111fd8 100644\n--- a/src/plone/rest/zcml.py\n+++ b/src/plone/rest/zcml.py\n@@ -186,6 +186,7 @@ class ICORSPolicyDirective(Interface):\n title=u"Support Credentials",\n description=u"""Indicates whether the resource supports user\n credentials in the request.""",\n+ required=True,\n default=False,\n )\n \n'

Repository: plone.app.versioningbehavior
Repository: plone.rest


Branch: refs/heads/master
Date: 2021-02-10T15:29:06+01:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: https://github.com/plone/plone.app.versioningbehavior/commit/a7561c8692f366702ae047881b5a82d0f877cf6f
Date: 2021-02-10T17:48:27+01:00
Author: Maurits van Rees (mauritsvanrees) <m.van.rees@zestsoftware.nl>
Commit: https://github.com/plone/plone.rest/commit/cc8e7b3e6e3711b5a5c8138103881380f06746a6

Merge pull request #54 from plone/dx-siteroot
Merge pull request #115 from plone/maurits/allow-credentials-required

Check if we have the portal_repository tool before creating a version
Explicitly make allow_credentials required in CORS policy.

Files changed:
A news/53.bugfix
M plone/app/versioningbehavior/subscribers.py
A news/104.bugfix
M src/plone/rest/zcml.py

b'diff --git a/news/53.bugfix b/news/53.bugfix\nnew file mode 100644\nindex 0000000..21774c8\n--- /dev/null\n+++ b/news/53.bugfix\n@@ -0,0 +1 @@\n+Do not break if the portal_repository tool cannot be found\ndiff --git a/plone/app/versioningbehavior/subscribers.py b/plone/app/versioningbehavior/subscribers.py\nindex fa195f0..11859e7 100644\n--- a/plone/app/versioningbehavior/subscribers.py\n+++ b/plone/app/versioningbehavior/subscribers.py\n@@ -70,7 +70,12 @@ def create_initial_version_after_adding(context, event):\n version. If a changeNote was entered it\'s used as comment.\n """\n \n- pr = getToolByName(context, \'portal_repository\')\n+ pr = getToolByName(context, \'portal_repository\', None)\n+ if pr is None:\n+ # This can happen, e.g., when adding a Plone Site with versioning\n+ # and portal_repository is not yet created\n+ return\n+\n if not pr.isVersionable(context):\n # object is not versionable\n return\n'
b'diff --git a/news/104.bugfix b/news/104.bugfix\nnew file mode 100644\nindex 0000000..28ba451\n--- /dev/null\n+++ b/news/104.bugfix\n@@ -0,0 +1,3 @@\n+Explicitly make ``allow_credentials`` required in CORS policy.\n+This was the default for Bool fields until and including zope.schema 6.0.1, but in 6.1.0 this changed.\n+[maurits]\ndiff --git a/src/plone/rest/zcml.py b/src/plone/rest/zcml.py\nindex b41521b..d111fd8 100644\n--- a/src/plone/rest/zcml.py\n+++ b/src/plone/rest/zcml.py\n@@ -186,6 +186,7 @@ class ICORSPolicyDirective(Interface):\n title=u"Support Credentials",\n description=u"""Indicates whether the resource supports user\n credentials in the request.""",\n+ required=True,\n default=False,\n )\n \n'

0 comments on commit 6352814

Please sign in to comment.