~sirn/fanboi2

e21b3db390883e80585972a463f754e5ebbb6231 — Sirn Thanabulpong 1 year, 10 months ago 15c2dad
Move csrf configuration into core.csrf
3 files changed, 7 insertions(+), 2 deletions(-)

M fanboi2/core/__init__.py
A fanboi2/core/csrf.py
M fanboi2/core/session.py
M fanboi2/core/__init__.py => fanboi2/core/__init__.py +1 -0
@@ 4,6 4,7 @@ from pyramid.config import Configurator  # type: ignore
def includeme(config: Configurator):  # pragma: no cover
    config.include("fanboi2.core.auth")
    config.include("fanboi2.core.cache")
    config.include("fanboi2.core.csrf")
    config.include("fanboi2.core.geoip")
    config.include("fanboi2.core.redis")
    config.include("fanboi2.core.serializers")

A fanboi2/core/csrf.py => fanboi2/core/csrf.py +6 -0
@@ 0,0 1,6 @@
from pyramid.config import Configurator  # type: ignore
from pyramid.csrf import SessionCSRFStoragePolicy  # type: ignore


def includeme(config: Configurator):
    config.set_csrf_storage_policy(SessionCSRFStoragePolicy(key="_csrf"))

M fanboi2/core/session.py => fanboi2/core/session.py +0 -2
@@ 1,7 1,6 @@
import binascii

from pyramid.config import Configurator  # type: ignore
from pyramid.csrf import SessionCSRFStoragePolicy  # type: ignore
from pyramid_nacl_session import EncryptedCookieSessionFactory  # type: ignore




@@ 13,4 12,3 @@ def includeme(config: Configurator):
    )

    config.set_session_factory(session_factory)
    config.set_csrf_storage_policy(SessionCSRFStoragePolicy(key="_csrf"))