From 04ecd5542849191457ccfc3e42a39452db47825a Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 21 Apr 2015 15:26:47 +0200 Subject: Strip trailing spaces --- paste/lint.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'paste/lint.py') diff --git a/paste/lint.py b/paste/lint.py index 0eedfa2..fac8948 100644 --- a/paste/lint.py +++ b/paste/lint.py @@ -133,7 +133,7 @@ def middleware(application, global_conf=None): will be printed to stderr -- there's no way to throw an exception at that point). """ - + def lint_app(*args, **kw): assert len(args) == 2, "Two arguments required" assert not kw, "No keyword arguments allowed" @@ -200,7 +200,7 @@ class InputWrapper(object): for line in lines: assert type(line) is type("") return lines - + def __iter__(self): while 1: line = self.readline() @@ -270,7 +270,7 @@ class IteratorWrapper(object): return v __next__ = next - + def close(self): self.closed = True if hasattr(self.original_iterator, 'close'): @@ -287,7 +287,7 @@ def check_environ(environ): assert isinstance(environ,dict), ( "Environment is not of the right type: %r (environment: %r)" % (type(environ), environ)) - + for key in ['REQUEST_METHOD', 'SERVER_NAME', 'SERVER_PORT', 'wsgi.version', 'wsgi.input', 'wsgi.errors', 'wsgi.multithread', 'wsgi.multiprocess', @@ -314,7 +314,7 @@ def check_environ(environ): assert isinstance(environ[key], str), ( "Environmental variable %s is not a string: %r (value: %r)" % (key, type(environ[key]), environ[key])) - + assert isinstance(environ['wsgi.version'], tuple), ( "wsgi.version should be a tuple (%r)" % environ['wsgi.version']) assert environ['wsgi.url_scheme'] in ('http', 'https'), ( -- cgit v1.2.1 From 7fb1d04880da53aeebd94dec9e4f67e3bf631c2a Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 21 Apr 2015 18:00:57 +0200 Subject: Port paste.lint to Python 3 * Expect bytes, not Unicode * Fix ErrorWrapper on Python 3: write() parameter must be bytes --- paste/lint.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'paste/lint.py') diff --git a/paste/lint.py b/paste/lint.py index fac8948..d781686 100644 --- a/paste/lint.py +++ b/paste/lint.py @@ -185,20 +185,20 @@ class InputWrapper(object): def read(self, *args): assert len(args) <= 1 v = self.input.read(*args) - assert type(v) is type("") + assert isinstance(v, six.binary_type) return v def readline(self, *args): v = self.input.readline(*args) - assert type(v) is type("") + assert isinstance(v, six.binary_type) return v def readlines(self, *args): assert len(args) <= 1 lines = self.input.readlines(*args) - assert type(lines) is type([]) + assert isinstance(lines, list) for line in lines: - assert type(line) is type("") + assert isinstance(line, six.binary_type) return lines def __iter__(self): @@ -217,7 +217,7 @@ class ErrorWrapper(object): self.errors = wsgi_errors def write(self, s): - assert type(s) is type("") + assert isinstance(s, bytes) self.errors.write(s) def flush(self): @@ -236,7 +236,7 @@ class WriteWrapper(object): self.writer = wsgi_writer def __call__(self, s): - assert type(s) is type("") + assert isinstance(s, six.binary_type) self.writer(s) class PartialIteratorWrapper(object): -- cgit v1.2.1