-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Branch: refs/heads/master Date: 2016-11-25T17:45:59+01:00 Author: Maurits van Rees (mauritsvanrees) <[email protected]> Commit: plone/plone.protect@e273918 Allow `confirm-action` for all contexts, instead of only Plone Site root. This avoids an error when calling it on a subsite. Fixes plone/plone.protect#51. Files changed: M CHANGES.rst M plone/protect/configure.zcml Repository: plone.protect Branch: refs/heads/master Date: 2016-11-25T21:28:45+01:00 Author: Gil Forcada Codinachs (gforcada) <[email protected]> Commit: plone/plone.protect@2be2215 Merge pull request #60 from plone/confirm-view-for-all-contexts Allow `confirm-action` for all contexts, instead of only Plone Site Files changed: M CHANGES.rst M plone/protect/configure.zcml
- Loading branch information
Showing
1 changed file
with
60 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,125 +2,100 @@ Repository: plone.protect | |
|
||
|
||
Branch: refs/heads/master | ||
Date: 2016-11-25T07:15:00+01:00 | ||
Author: Jens W. Klein (jensens) <[email protected]> | ||
Commit: https://github.com/plone/plone.protect/commit/36f2a7380beace2c377062531d63062ba48ed4f0 | ||
Date: 2016-11-25T17:45:59+01:00 | ||
Author: Maurits van Rees (mauritsvanrees) <[email protected]> | ||
Commit: https://github.com/plone/plone.protect/commit/e273918289b220d6bd384cf28c1ea519dd0eb109 | ||
|
||
Allow `confirm-action` for all contexts, instead of only Plone Site root. | ||
|
||
fixes #57 Html must contain body, otherwise plone.protect breaks | ||
This avoids an error when calling it on a subsite. | ||
Fixes https://github.com/plone/plone.protect/issues/51. | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M plone/protect/auto.py | ||
M plone/protect/configure.zcml | ||
|
||
diff --git a/CHANGES.rst b/CHANGES.rst | ||
index 254daed..dd39d8a 100644 | ||
index dd39d8a..098b716 100644 | ||
--- a/CHANGES.rst | ||
+++ b/CHANGES.rst | ||
@@ -16,6 +16,9 @@ Bug fixes: | ||
@@ -14,8 +14,14 @@ New features: | ||
|
||
Bug fixes: | ||
|
||
+- Allow ``confirm-action`` for all contexts, instead of only Plone Site root. | ||
+ This avoids an error when calling it on a subsite. | ||
+ Fixes `issue #51 <https://github.com/plone/plone.protect/issues/51>`_. | ||
+ [maurits] | ||
+ | ||
- Code Style: utf8-headers, import sorting, new style namespace declaration, autopep8 | ||
[jensens] | ||
+- Fix #57: Html must contain "body", otherwise plone.protect breaks. | ||
+ [jensens] | ||
+ | ||
- Fix #57: Html must contain "body", otherwise plone.protect breaks. | ||
[jensens] | ||
|
||
3.0.22 (2016-11-17) | ||
------------------- | ||
diff --git a/plone/protect/auto.py b/plone/protect/auto.py | ||
index 3e7cbdf..445aaaf 100644 | ||
--- a/plone/protect/auto.py | ||
+++ b/plone/protect/auto.py | ||
@@ -357,15 +357,17 @@ def transform(self, result, encoding): | ||
if self.site is not None and not root.cssselect('#protect-script'): | ||
# Alternative: add this in the resource registry. | ||
site_url = self.site.absolute_url() | ||
- body = root.cssselect('body')[0] | ||
- protect_script = etree.Element("script") | ||
- protect_script.attrib.update({ | ||
- 'type': "application/javascript", | ||
- 'src': "%s/++resource++protect.js" % site_url, | ||
- 'data-site-url': site_url, | ||
- 'data-token': token, | ||
- 'id': 'protect-script' | ||
- }) | ||
- body.append(protect_script) | ||
+ elements = root.cssselect('body') | ||
+ if len(elements): | ||
+ body = elements[0] | ||
+ protect_script = etree.Element("script") | ||
+ protect_script.attrib.update({ | ||
+ 'type': "application/javascript", | ||
+ 'src': "%s/++resource++protect.js" % site_url, | ||
+ 'data-site-url': site_url, | ||
+ 'data-token': token, | ||
+ 'id': 'protect-script' | ||
+ }) | ||
+ body.append(protect_script) | ||
diff --git a/plone/protect/configure.zcml b/plone/protect/configure.zcml | ||
index d31bd7c..0f7f711 100644 | ||
--- a/plone/protect/configure.zcml | ||
+++ b/plone/protect/configure.zcml | ||
@@ -42,7 +42,7 @@ | ||
|
||
return result | ||
<browser:page | ||
name="confirm-action" | ||
- for="Products.CMFPlone.interfaces.IPloneSiteRoot" | ||
+ for="*" | ||
class=".views.ConfirmView" | ||
template="confirm.pt" | ||
permission="zope2.View" | ||
|
||
|
||
Repository: plone.protect | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2016-11-25T17:36:27+01:00 | ||
Author: Maurits van Rees (mauritsvanrees) <[email protected]> | ||
Commit: https://github.com/plone/plone.protect/commit/9ef98811ecfdf23e7f3a76af7b1ab8f4451ad083 | ||
Date: 2016-11-25T21:28:45+01:00 | ||
Author: Gil Forcada Codinachs (gforcada) <[email protected]> | ||
Commit: https://github.com/plone/plone.protect/commit/2be2215047113a86ce36166871ea41afd2cda490 | ||
|
||
Merge pull request #59 from plone/jensens-fix-57 | ||
Merge pull request #60 from plone/confirm-view-for-all-contexts | ||
|
||
Fix #57: Html must contain "body", otherwise plone.protect breaks. | ||
Allow `confirm-action` for all contexts, instead of only Plone Site | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M plone/protect/auto.py | ||
M plone/protect/configure.zcml | ||
|
||
diff --git a/CHANGES.rst b/CHANGES.rst | ||
index 254daed..dd39d8a 100644 | ||
index dd39d8a..098b716 100644 | ||
--- a/CHANGES.rst | ||
+++ b/CHANGES.rst | ||
@@ -16,6 +16,9 @@ Bug fixes: | ||
@@ -14,8 +14,14 @@ New features: | ||
|
||
Bug fixes: | ||
|
||
+- Allow ``confirm-action`` for all contexts, instead of only Plone Site root. | ||
+ This avoids an error when calling it on a subsite. | ||
+ Fixes `issue #51 <https://github.com/plone/plone.protect/issues/51>`_. | ||
+ [maurits] | ||
+ | ||
- Code Style: utf8-headers, import sorting, new style namespace declaration, autopep8 | ||
[jensens] | ||
+- Fix #57: Html must contain "body", otherwise plone.protect breaks. | ||
+ [jensens] | ||
+ | ||
- Fix #57: Html must contain "body", otherwise plone.protect breaks. | ||
[jensens] | ||
|
||
3.0.22 (2016-11-17) | ||
------------------- | ||
diff --git a/plone/protect/auto.py b/plone/protect/auto.py | ||
index 3e7cbdf..445aaaf 100644 | ||
--- a/plone/protect/auto.py | ||
+++ b/plone/protect/auto.py | ||
@@ -357,15 +357,17 @@ def transform(self, result, encoding): | ||
if self.site is not None and not root.cssselect('#protect-script'): | ||
# Alternative: add this in the resource registry. | ||
site_url = self.site.absolute_url() | ||
- body = root.cssselect('body')[0] | ||
- protect_script = etree.Element("script") | ||
- protect_script.attrib.update({ | ||
- 'type': "application/javascript", | ||
- 'src': "%s/++resource++protect.js" % site_url, | ||
- 'data-site-url': site_url, | ||
- 'data-token': token, | ||
- 'id': 'protect-script' | ||
- }) | ||
- body.append(protect_script) | ||
+ elements = root.cssselect('body') | ||
+ if len(elements): | ||
+ body = elements[0] | ||
+ protect_script = etree.Element("script") | ||
+ protect_script.attrib.update({ | ||
+ 'type': "application/javascript", | ||
+ 'src': "%s/++resource++protect.js" % site_url, | ||
+ 'data-site-url': site_url, | ||
+ 'data-token': token, | ||
+ 'id': 'protect-script' | ||
+ }) | ||
+ body.append(protect_script) | ||
diff --git a/plone/protect/configure.zcml b/plone/protect/configure.zcml | ||
index d31bd7c..0f7f711 100644 | ||
--- a/plone/protect/configure.zcml | ||
+++ b/plone/protect/configure.zcml | ||
@@ -42,7 +42,7 @@ | ||
|
||
return result | ||
<browser:page | ||
name="confirm-action" | ||
- for="Products.CMFPlone.interfaces.IPloneSiteRoot" | ||
+ for="*" | ||
class=".views.ConfirmView" | ||
template="confirm.pt" | ||
permission="zope2.View" | ||
|
||
|