diff options
-rw-r--r-- | cherrypy/_cptools.py | 10 | ||||
-rw-r--r-- | cherrypy/lib/caching.py | 5 | ||||
-rw-r--r-- | cherrypy/lib/encoding.py (renamed from cherrypy/lib/encodings.py) | 1 |
3 files changed, 9 insertions, 7 deletions
diff --git a/cherrypy/_cptools.py b/cherrypy/_cptools.py index f536f8c0..7919ac50 100644 --- a/cherrypy/_cptools.py +++ b/cherrypy/_cptools.py @@ -144,7 +144,7 @@ class ErrorTool(Tool): # Builtin tools # -from cherrypy.lib import cptools, encodings, static +from cherrypy.lib import cptools, encoding, static from cherrypy.lib import sessions as _sessions, xmlrpc as _xmlrpc from cherrypy.lib import caching as _caching, wsgiapp as _wsgiapp @@ -293,9 +293,9 @@ default_toolbox.log_tracebacks = Tool('before_error_response', cptools.log_trace default_toolbox.log_headers = Tool('before_error_response', cptools.log_request_headers) default_toolbox.err_redirect = ErrorTool(cptools.redirect) default_toolbox.etags = Tool('before_finalize', cptools.validate_etags) -default_toolbox.decode = Tool('before_main', encodings.decode) -default_toolbox.encode = Tool('before_finalize', encodings.encode) -default_toolbox.gzip = Tool('before_finalize', encodings.gzip) +default_toolbox.decode = Tool('before_main', encoding.decode) +default_toolbox.encode = Tool('before_finalize', encoding.encode) +default_toolbox.gzip = Tool('before_finalize', encoding.gzip) default_toolbox.staticdir = StaticDirTool(static.staticdir) default_toolbox.staticfile = MainTool(static.staticfile) default_toolbox.sessions = SessionTool() @@ -304,4 +304,4 @@ default_toolbox.wsgiapp = WSGIAppTool(_wsgiapp.run) default_toolbox.caching = CachingTool() -del cptools, encodings, static +del cptools, encoding, static diff --git a/cherrypy/lib/caching.py b/cherrypy/lib/caching.py index c1187634..3f70b62f 100644 --- a/cherrypy/lib/caching.py +++ b/cherrypy/lib/caching.py @@ -103,8 +103,9 @@ def init(cache_class=None): def get(): # Ignore POST, PUT, DELETE. # See http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.10. - if cherrypy.request.method in cherrypy.config.get("tools.caching.invalid_methods", - ("POST", "PUT", "DELETE")): + invalid = cherrypy.config.get("tools.caching.invalid_methods", + ("POST", "PUT", "DELETE")) + if cherrypy.request.method in invalid: cherrypy.request.cached = c = False else: cacheData = cherrypy._cache.get() diff --git a/cherrypy/lib/encodings.py b/cherrypy/lib/encoding.py index f0ec7fb7..5496936d 100644 --- a/cherrypy/lib/encodings.py +++ b/cherrypy/lib/encoding.py @@ -5,6 +5,7 @@ import cherrypy def decode(encoding=None, default_encoding='utf-8'): + """Decode cherrypy.request.params .""" if not encoding: ct = cherrypy.request.headers.elements("Content-Type") if ct: |