Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
CSRF debug helper: Trigger CSRF protection
<configure
xmlns:browser="http://namespaces.zope.org/browser">
<browser:page
name="trigger-csrf"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
class=".trigger.TriggerCSRFProtection"
permission="cmf.ManagePortal"
/>
</configure>
from zope.publisher.browser import BrowserView
class TriggerCSRFProtection(BrowserView):
def __call__(self):
self.request.response.setHeader("Content-Type", 'text/html')
self._do_write()
return '<h1>Done</h1>'
def _do_write(self):
self.context.myattr = 'foo'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment