Skip to content

Instantly share code, notes, and snippets.

@lukasgraf
Created October 11, 2015 16:02
Show Gist options
  • Save lukasgraf/7fc10a1689354665afd7 to your computer and use it in GitHub Desktop.
Save lukasgraf/7fc10a1689354665afd7 to your computer and use it in GitHub Desktop.
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