diff options
author | Simo Sorce <simo@redhat.com> | 2015-01-26 17:10:20 -0500 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2015-01-26 17:42:48 -0500 |
commit | 034fd7a63e5582e18f1436388a2abc2b23567396 (patch) | |
tree | 9bccba9a063dca700ca1f4ab4c51fbd40e9e48e6 /ipsilon | |
parent | 74194d5d36cfc1be67e92924585731e9b3894605 (diff) | |
download | ipsilon.git-034fd7a63e5582e18f1436388a2abc2b23567396.tar.gz ipsilon.git-034fd7a63e5582e18f1436388a2abc2b23567396.tar.xz ipsilon.git-034fd7a63e5582e18f1436388a2abc2b23567396.zip |
Fix int/pep8 errors in latest patches
Mea culpa for not checking before pushing
Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: John Dennis <jdennis@redhat.com>
Diffstat (limited to 'ipsilon')
-rw-r--r-- | ipsilon/util/log.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/ipsilon/util/log.py b/ipsilon/util/log.py index 857a5ba..0a7a9df 100644 --- a/ipsilon/util/log.py +++ b/ipsilon/util/log.py @@ -8,6 +8,7 @@ import inspect import os import traceback + def log_request_response(): '''Log the contents of the request and subsequent response. @@ -81,7 +82,7 @@ def log_request_response(): ''' - #--- Begin local functions --- + # --- Begin local functions --- def indent_text(text, level=0, indent=' '): ''' @@ -170,7 +171,7 @@ def log_request_response(): f.close() return string - #--- End local functions --- + # --- End local functions --- f = cStringIO.StringIO() request = cherrypy.serving.request @@ -179,8 +180,8 @@ def log_request_response(): # # Log the Request # - f.write(indent_text("<Request> [%s] %s\n" % \ - (remote.name or remote.ip, request.request_line), 0)) + f.write(indent_text("<Request> [%s] %s\n" % + (remote.name or remote.ip, request.request_line), 0)) # Request Headers if request.headers: @@ -197,12 +198,13 @@ def log_request_response(): if isinstance(value, list): for i, item in enumerate(value): # Might be a multipart Part object, if so format it - if isinstance(item, cherrypy._cpreqbody.Part): + if getattr(item, "part_class", None): f.write(indent_text("%s[%s]:\n" % (name, i), 2)) f.write(indent_text(print_part(item), 3)) else: # Not a mulitpart, just write it as a string - f.write(indent_text("%s[%s]: %s\n" % (name, i, item), 2)) + f.write(indent_text("%s[%s]: %s\n" % + (name, i, item), 2)) else: # Just a string value f.write(indent_text("%s: %s\n" % (name, value), 2)) @@ -243,7 +245,8 @@ def log_request_response(): f.close() print string -cherrypy.tools.log_request_response = cherrypy.Tool('on_end_resource', log_request_response) +cherrypy.tools.log_request_response = cherrypy.Tool('on_end_resource', + log_request_response) class Log(object): @@ -277,7 +280,7 @@ class Log(object): args, _, _, value_dict = inspect.getargvalues(frame_obj) # Is the functions first parameter named 'self'? if len(args) and args[0] == 'self': - # in that case, 'self' will be referenced in value_dict + # in that case, 'self' will be referenced in value_dict instance = value_dict.get('self', None) if instance: # return its class @@ -304,7 +307,6 @@ class Log(object): location = '%s:%s %s()' % (filename, line_number, func) return location - def debug(self, fact): if cherrypy.config.get('debug', False): location = Log.call_location() |