Mercurial > p > roundup > code
comparison roundup/cgi/templating.py @ 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 | 23b8e6067f7c |
| children | 88dbacd11cd1 |
comparison
equal
deleted
inserted
replaced
| 5398:99667a0cbd2d | 5399:dccae35caa59 |
|---|---|
| 54 StructuredText = None | 54 StructuredText = None |
| 55 try: | 55 try: |
| 56 from docutils.core import publish_parts as ReStructuredText | 56 from docutils.core import publish_parts as ReStructuredText |
| 57 except ImportError: | 57 except ImportError: |
| 58 ReStructuredText = None | 58 ReStructuredText = None |
| 59 try: | |
| 60 from itertools import zip_longest | |
| 61 except ImportError: | |
| 62 from itertools import izip_longest as zip_longest | |
| 59 | 63 |
| 60 # bring in the templating support | 64 # bring in the templating support |
| 61 from roundup.cgi import TranslationService, ZTUtils | 65 from roundup.cgi import TranslationService, ZTUtils |
| 62 | 66 |
| 63 ### i18n services | 67 ### i18n services |
| 2612 # sometimes requests come in without a class | 2616 # sometimes requests come in without a class |
| 2613 # chances are they won't have any filter params, | 2617 # chances are they won't have any filter params, |
| 2614 # in that case anyway but... | 2618 # in that case anyway but... |
| 2615 if self.classname: | 2619 if self.classname: |
| 2616 cls = self.client.db.getclass(self.classname) | 2620 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): |
| 2618 if f.startswith('-'): | 2622 if f.startswith('-'): |
| 2619 dir, propname = '-', f[1:] | 2623 dir, propname = '-', f[1:] |
| 2620 elif d: | 2624 elif d: |
| 2621 dir, propname = '-', f | 2625 dir, propname = '-', f |
| 2622 else: | 2626 else: |
