Closed mauritsvanrees closed 6 years ago
I think most of the contortions here are to find the request in the function arguments. We should just use zope.globalrequest.getRequest
for that, and use functools.wraps
to make sure that the protect decorator has nice properties like keeping the name and docstring of the original function.
I think, because of its importance, we should merge it now and defer further optimizations.
Agreed, that is what I meant: any further optimizations should be done on the master branch. But that can be done later. Preferably before 5.2 is out, but that can take a while. :-)
This PR is for branch 3.x that I have just created. It is used by coredev 5.0 and 5.1. With
plone4.csrffixes
it should still be fine for Plone 4.3 as well.For info on the breakage see mostly issue #74, and a bit #75.
This PR basically reverts PR #72 on branch 3.x, except commit 7edf02d3b16e5c6b03e1288ba1cecfe9bcb4761f which seems harmless (plus the changelog entry, which should remain for historical accuracy).
The py3 changes should remain on master, used by Plone 5.2. But I hope that it can be replaced by code that looks less scary. To quote a comment from the code: "It should probably be updated to use the decorator module."