Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 454daaeb19
Fetching contributors…

Cannot retrieve contributors at this time

15 lines (10 sloc) 0.481 kB
from pyramid.httpexceptions import HTTPForbidden
from pyramid.renderers import get_renderer
def add_base_template(event):
base = get_renderer('templates/base.pt').implementation()
event.update({'base': base})
def csrf_validation(event):
if event.request.method == "POST":
token = event.request.POST.get("_csrf")
if token is None or token != event.request.session.get_csrf_token():
raise HTTPForbidden('CSRF token is missing or invalid')
Jump to Line
Something went wrong with that request. Please try again.