From a8886fd1cf9755d08ed348cd05560b42c249c9a5 Mon Sep 17 00:00:00 2001 From: Amit Markel Date: Tue, 14 Jul 2020 13:23:13 +0300 Subject: Py3-compat middleware.py's make_table's item sort (#55) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In py2 an array is created and sorted, and in py3 an array of the items needs to be realized in the same fashion hence the sorted(•) fix. Otherwise the code will fail on Python 3 since dict.items() returns a view on the items which doesn't have a .sort() method. --- paste/evalexception/middleware.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'paste') diff --git a/paste/evalexception/middleware.py b/paste/evalexception/middleware.py index d086344..bc2883e 100644 --- a/paste/evalexception/middleware.py +++ b/paste/evalexception/middleware.py @@ -456,8 +456,7 @@ class EvalHTMLFormatter(formatter.HTMLFormatter): def make_table(items): if isinstance(items, dict): - items = items.items() - items.sort() + items = sorted(items.items()) rows = [] i = 0 for name, value in items: -- cgit v1.2.1