changeset 5399:dccae35caa59

Python 3 preparation: update map() calls as needed. Tool-assisted patch. Note one place using map with first argument None (not supported in Python 3) which needed to change to using itertools.zip_longest (respectively itertools.izip_longest in Python 2).
author Joseph Myers <jsm@polyomino.org.uk>
date Tue, 24 Jul 2018 23:14:56 +0000
parents 99667a0cbd2d
children 2120f77554d5
files frontends/ZRoundup/ZRoundup.py roundup/cgi/templating.py
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/ZRoundup/ZRoundup.py	Tue Jul 24 23:14:04 2018 +0000
+++ b/frontends/ZRoundup/ZRoundup.py	Tue Jul 24 23:14:56 2018 +0000
@@ -88,7 +88,7 @@
     def __getitem__(self, item):
         entry = self.__form[item]
         if isinstance(entry, type([])):
-            entry = map(FormItem, entry)
+            entry = list(map(FormItem, entry))
         else:
             entry = FormItem(entry)
         return entry
--- a/roundup/cgi/templating.py	Tue Jul 24 23:14:04 2018 +0000
+++ b/roundup/cgi/templating.py	Tue Jul 24 23:14:56 2018 +0000
@@ -56,6 +56,10 @@
     from docutils.core import publish_parts as ReStructuredText
 except ImportError:
     ReStructuredText = None
+try:
+    from itertools import zip_longest
+except ImportError:
+    from itertools import izip_longest as zip_longest
 
 # bring in the templating support
 from roundup.cgi import TranslationService, ZTUtils
@@ -2614,7 +2618,7 @@
         # in that case anyway but...
         if self.classname:
             cls = self.client.db.getclass(self.classname)
-        for f, d in map(None, fields, dirs):
+        for f, d in zip_longest(fields, dirs):
             if f.startswith('-'):
                 dir, propname = '-', f[1:]
             elif d:

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