diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2017-12-17 00:52:58 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2017-12-17 00:52:58 -0500 |
commit | 52682a78ee9c471bcb5f0f02cde69b63202b02de (patch) | |
tree | c4cf97ed5052032833ae8bcf9b07f637ff7aa9f3 | |
parent | 9a143b81c9b0a13274e8abb05445276f7189bfb5 (diff) | |
download | cherrypy-git-use-projection.tar.gz |
Demonstrate how a Projection might be a nice way to assign some parameters.use-projection
-rw-r--r-- | cherrypy/_cptools.py | 8 | ||||
-rwxr-xr-x | setup.py | 1 |
2 files changed, 4 insertions, 5 deletions
diff --git a/cherrypy/_cptools.py b/cherrypy/_cptools.py index 92c2b656..e51a963c 100644 --- a/cherrypy/_cptools.py +++ b/cherrypy/_cptools.py @@ -25,6 +25,8 @@ are generally either modules or instances of the tools.Tool class. import sys import warnings +from jaraco.collections import Projection + import cherrypy from cherrypy._helper import expose @@ -323,11 +325,7 @@ class SessionTool(Tool): # Grab cookie-relevant tool args relevant = 'path', 'path_header', 'name', 'timeout', 'domain', 'secure' - conf = dict( - (k, v) - for k, v in self._merged_args().items() - if k in relevant - ) + conf = Projection(relevant, self._merged_args()) _sessions.set_response_cookie(**conf) @@ -58,6 +58,7 @@ install_requires = [ 'cheroot>=5.9.1', 'portend>=2.1.1', 'jaraco.classes', + 'jaraco.collections', ] extras_require = { |