Skip to content

Commit bd39b8e

Browse files
author
Greg Turnquist
committed
Fixed CP3FilterChainProxy to work correctly.
1 parent 93d94c1 commit bd39b8e

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

src/plugins/gen-cherrypy-app/cherrypy-app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
conf = {'/': {"tools.staticdir.root": os.getcwd(),
4747
"tools.sessions.on": True,
48-
"tools.filterChainProxy.on": True},
48+
"tools.securityFilterChain.on": True},
4949
"/images": {"tools.staticdir.on": True,
5050
"tools.staticdir.dir": "images"}
5151
}

src/springpython/security/cherrypy3.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,23 @@
2626
class CP3FilterChainProxy(FilterChainProxy):
2727
def __init__(self, filterInvocationDefinitionSource=None):
2828
FilterChainProxy.__init__(self, filterInvocationDefinitionSource)
29-
self.logger = logging.getLogger("springpython.security.cherrypy3.CP3FilterChainProxy")
30-
cherrypy.tools.filterChainProxy = cherrypy._cptools.HandlerTool(self)
29+
self.logger = logging.getLogger("springpython.security.cherrypy3.Another")
30+
cherrypy.tools.securityFilterChain = cherrypy._cptools.HandlerTool(self)
3131

3232
def __call__(self, environ=None, start_response=None):
33-
innerfunc = cherrypy.request.handler
34-
def mini_app(*args, **kwargs):
35-
def cherrypy_wrapper(nexthandler, *args, **kwargs):
36-
results = nexthandler(*args, **kwargs)
37-
self.logger.debug("Results = %s" % results)
38-
return results
39-
return cherrypy_wrapper(innerfunc, *args, **kwargs)
33+
if cherrypy.request.handler is None:
34+
return False
4035

41-
self.application = (self.invoke, (mini_app,))
36+
def cherrypy_handler(*args, **kwargs):
37+
return cherrypy.request.handler(*args, **kwargs)
4238

43-
# Store the final results...
39+
def func(args):
40+
return args[0]()
41+
42+
self.application = (func, (cherrypy_handler,))
4443
cherrypy.response.body = FilterChainProxy.__call__(self, cherrypy.request.wsgi_environ, None)
45-
#...and then signal there is no more handling for CherryPy to do.
4644
return True
4745

48-
def invoke(self, args):
49-
return args[0]()
50-
5146
class CP3SessionStrategy(SessionStrategy):
5247
def __init__(self):
5348
SessionStrategy.__init__(self)

0 commit comments

Comments
 (0)