comparison roundup/cgi/client.py @ 5395:23b8e6067f7c

Python 3 preparation: update calls to dict methods. Tool-assisted patch. Changes of iterkeys / itervalues / iteritems to keys / values / items are fully automated, but may make things less efficient in Python 2. Automated tools want to add list() around many calls to keys / values / items, but I thought most such list() additions were unnecessary because it seemed the result of keys / values / items was just iterated over while the set of dict keys remained unchanged, rather than used in a way requiring an actual list, or used while the set of keys in the dict could change. It's quite possible I missed some cases where list() was really needed, or left in some unnecessary list() calls. In cases where list() was only needed because the resulting list was then sorted in-place, I changed the code to use calls to sorted().
author Joseph Myers <jsm@polyomino.org.uk>
date Tue, 24 Jul 2018 23:04:42 +0000
parents 35ea9b1efc14
children e46ce04d5bbc
comparison
equal deleted inserted replaced
5394:c26d88ec071e 5395:23b8e6067f7c
2057 if headers.get('Content-Type', 'text/html') == 'text/html': 2057 if headers.get('Content-Type', 'text/html') == 'text/html':
2058 headers['Content-Type'] = 'text/html; charset=utf-8' 2058 headers['Content-Type'] = 'text/html; charset=utf-8'
2059 2059
2060 headers = list(headers.items()) 2060 headers = list(headers.items())
2061 2061
2062 for ((path, name), (value, expire)) in self._cookies.iteritems(): 2062 for ((path, name), (value, expire)) in self._cookies.items():
2063 cookie = "%s=%s; Path=%s;"%(name, value, path) 2063 cookie = "%s=%s; Path=%s;"%(name, value, path)
2064 if expire is not None: 2064 if expire is not None:
2065 cookie += " expires=%s;"%get_cookie_date(expire) 2065 cookie += " expires=%s;"%get_cookie_date(expire)
2066 # mark as secure if https, see issue2550689 2066 # mark as secure if https, see issue2550689
2067 if self.secure: 2067 if self.secure:

Roundup Issue Tracker: http://roundup-tracker.org/