r13802 - in Products.Archetypes/trunk: . Products/Archetypes/browser
"David Glick" <[email protected]> Sat, 17 Sep 2011 05:36:46 +0000
| Newsgroups | gmane.comp.web.zope.plone.archetypes.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: davisagli
Date: Sat Sep 17 05:36:45 2011
New Revision: 13802
Modified:
Products.Archetypes/trunk/CHANGES.txt
Products.Archetypes/trunk/Products/Archetypes/browser/configure.zcml
Products.Archetypes/trunk/Products/Archetypes/browser/edit.py
Log:
fix /edit on UnauthorizedBinding, fixes #12056
Modified: Products.Archetypes/trunk/CHANGES.txt
==============================================================================
--- Products.Archetypes/trunk/CHANGES.txt (original)
+++ Products.Archetypes/trunk/CHANGES.txt Sat Sep 17 05:36:45 2011
@@ -4,7 +4,10 @@
1.7.9 (unreleased)
------------------
-- Nothing changed yet.
+- Fix: Make sure user sees login form rather than an exception when trying
+ to access /edit on an unauthorized context.
+ This fixes http://dev.plone.org/plone/ticket/12056
+ [davisagli]
1.7.8 (2011-09-16)
Modified: Products.Archetypes/trunk/Products/Archetypes/browser/configure.zcml
==============================================================================
--- Products.Archetypes/trunk/Products/Archetypes/browser/configure.zcml (original)
+++ Products.Archetypes/trunk/Products/Archetypes/browser/configure.zcml Sat Sep 17 05:36:45 2011
@@ -18,6 +18,15 @@
permission="cmf.ModifyPortalContent"
allowed_interface="..interfaces.IEditForm"
/>
+
+ <!-- Make sure that if a user goes to /edit on an unauthorized context,
+ they get the login form rather than a LocationError -->
+ <browser:page
+ for="Shared.DC.Scripts.Bindings.UnauthorizedBinding"
+ name="at_base_edit_view"
+ class=".edit.UnauthorizedEdit"
+ permission="zope.Public"
+ />
<browser:page
for="..interfaces.IBaseObject"
Modified: Products.Archetypes/trunk/Products/Archetypes/browser/edit.py
==============================================================================
--- Products.Archetypes/trunk/Products/Archetypes/browser/edit.py (original)
+++ Products.Archetypes/trunk/Products/Archetypes/browser/edit.py Sat Sep 17 05:36:45 2011
@@ -2,6 +2,7 @@
from zope.interface import implements
from Acquisition import aq_inner
+from zExceptions import Unauthorized
from Products.CMFCore.utils import getToolByName
from Products.Five import BrowserView
@@ -55,3 +56,11 @@
if norm is not None:
return norm.normalize(text)
return text
+
+
+# This is a helper to make sure the user gets a login form if they go to
+# /edit on an unauthorized context.
+class UnauthorizedEdit(BrowserView):
+
+ def __call__(self):
+ raise Unauthorized
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2