python-modernize -f libmodernize.fixes.fix_basestring

This commit is contained in:
Tomas Kopecek 2018-06-28 16:55:25 +02:00 committed by Mike McLean
parent 7f6b717eb6
commit 5ad9027320
4 changed files with 18 additions and 17 deletions

View file

@ -33,6 +33,7 @@ import traceback
from ConfigParser import RawConfigParser
from koji.server import ServerError, ServerRedirect
from koji.util import dslice
import six
class URLNotFound(ServerError):
@ -397,14 +398,14 @@ class Dispatcher(object):
else:
# last one wins
headers[key] = (name, value)
if isinstance(result, basestring):
if isinstance(result, six.string_types):
headers.setdefault('content-length', ('Content-Length', str(len(result))))
headers.setdefault('content-type', ('Content-Type', 'text/html'))
headers = list(headers.values()) + extra
self.logger.debug("Headers:")
self.logger.debug(koji.util.LazyString(pprint.pformat, [headers]))
start_response(status, headers)
if isinstance(result, basestring):
if isinstance(result, six.string_types):
result = [result]
return result