From 392118d5367fc6f0192cbea4f271b9149de78dd1 Mon Sep 17 00:00:00 2001 From: Kyle Kelley Date: Sat, 22 Nov 2014 22:41:45 -0600 Subject: [PATCH] One unified CSP report URI --- IPython/html/services/security/__init__.py | 3 +++ IPython/html/services/security/handlers.py | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/IPython/html/services/security/__init__.py b/IPython/html/services/security/__init__.py index c660a562f..9cf0d476b 100644 --- a/IPython/html/services/security/__init__.py +++ b/IPython/html/services/security/__init__.py @@ -1 +1,4 @@ +# URI for the CSP Report. Included here to prevent a cyclic dependency. +# csp_report_uri is needed both by the BaseHandler (for setting the report-uri) +# and by the CSPReportHandler (which depends on the BaseHandler). csp_report_uri = r"/api/security/csp-report" diff --git a/IPython/html/services/security/handlers.py b/IPython/html/services/security/handlers.py index 120279fa4..e33fe83ce 100644 --- a/IPython/html/services/security/handlers.py +++ b/IPython/html/services/security/handlers.py @@ -6,6 +6,7 @@ from tornado import gen, web from ...base.handlers import IPythonHandler, json_errors +from . import csp_report_uri class CSPReportHandler(IPythonHandler): '''Accepts a content security policy violation report''' @@ -16,8 +17,6 @@ class CSPReportHandler(IPythonHandler): csp_report = self.get_json_body() self.log.debug(csp_report) -csp_report_uri = r"/api/security/csp-report" - default_handlers = [ (csp_report_uri, CSPReportHandler) ]