Skip to content

Commit 8f35136

Browse files
committed
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).
1 parent 2958c3f commit 8f35136

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

frontends/ZRoundup/ZRoundup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def __init__(self, form):
8888
def __getitem__(self, item):
8989
entry = self.__form[item]
9090
if isinstance(entry, type([])):
91-
entry = map(FormItem, entry)
91+
entry = list(map(FormItem, entry))
9292
else:
9393
entry = FormItem(entry)
9494
return entry

roundup/cgi/templating.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
from docutils.core import publish_parts as ReStructuredText
5757
except ImportError:
5858
ReStructuredText = None
59+
try:
60+
from itertools import zip_longest
61+
except ImportError:
62+
from itertools import izip_longest as zip_longest
5963

6064
# bring in the templating support
6165
from roundup.cgi import TranslationService, ZTUtils
@@ -2614,7 +2618,7 @@ def _parse_sort(self, var, name):
26142618
# in that case anyway but...
26152619
if self.classname:
26162620
cls = self.client.db.getclass(self.classname)
2617-
for f, d in map(None, fields, dirs):
2621+
for f, d in zip_longest(fields, dirs):
26182622
if f.startswith('-'):
26192623
dir, propname = '-', f[1:]
26202624
elif d:

0 commit comments

Comments
 (0)