Skip to content

Commit 81d6117

Browse files
committed
fix: add support for dicttoxml2.py
The older dicttoxml.py uses a type alias collections.Iterator that is removed post Python 3.10. Add support for dictoxml.py updated replacement. Norbert SCHLEMMER found it when testing the arm docker under 3.12.
1 parent 93a4d61 commit 81d6117

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ Fixed:
6767
Rouillard)
6868
- disable proxy with wget in roundup_healthcheck. (Norbert SCHLEMMER
6969
Noschvie on github.com)
70+
- support dicttoxml2.py for Roundup running on 3.7 and
71+
newer. dicttoxml uses a type alias: collection.Iterator that is
72+
dropped in Python 3.10. (found by Norbert SCHLEMMER, fix John
73+
Rouillard)
7074

7175
Features:
7276

doc/rest.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,14 @@ Response Formats
311311

312312
The default response format is json.
313313

314-
If you add the ``dicttoxml.py`` module you can request XML formatted
314+
If you add the ``dicttoxml2.py`` module you can request XML formatted
315315
data using the header ``Accept: application/xml`` in your
316316
request. Both output formats are similar in structure.
317317

318-
``dicttoxml.py`` should be installed in the Python install directory,
319-
or the file can be added to the Roundup installation directory long
320-
ide ``rest.py``. It can also be enabled on a per tracker basis by
321-
adding ``dicttoxml.py`` to the lib directory in your tracker home (you
318+
``dicttoxml2.py`` should be installed in the Python install directory,
319+
or the file can be added to the Roundup installation directory along
320+
side ``rest.py``. It can also be enabled on a per tracker basis by
321+
adding ``dicttoxml2.py`` to the lib directory in your tracker home (you
322322
may need to create the directory). Then this can be added to
323323
`interfaces.py`_ to enable xml::
324324

@@ -334,14 +334,18 @@ The rest interface accepts the http accept header and can include
334334
way to specify alternate acceptable response formats.
335335

336336
To make testing from the browser easier, you can also append the
337-
extension `.json` or `.xml` to the path component of the url. This
337+
extension ``.json`` or ``.xml`` to the path component of the url. This
338338
will force json or xml (if supported) output. If you use an extension
339339
it takes priority over any accept headers.
340340

341341
The rest interface returns status 406 if you use an unrecognized
342342
extension. You will also get a 406 status if none of the entries in
343343
the accept header are available or if the accept header is invalid.
344344

345+
Note: ``dicttoxml2.py`` is an updated version of ``dicttoxml.py``. If
346+
you are still using Python 2.7 or 3.6, you should use
347+
``dicttoxml.py``.
348+
345349

346350
General Guidelines
347351
------------------

roundup/rest.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,23 @@
3535
logger = logging.getLogger('roundup.rest')
3636

3737
try:
38-
# if dicttoxml installed in roundup directory, use it
39-
from roundup.dicttoxml import dicttoxml
38+
# if dicttoxml2 (or dicttoxml for Python <= 3.6)
39+
# is installed in roundup directory, use it
40+
from roundup.dicttoxml2 import dicttoxml
4041
except ImportError:
4142
try:
4243
# else look in sys.path
43-
from dicttoxml import dicttoxml
44+
from dicttoxml2 import dicttoxml
4445
except ImportError:
45-
# else not supported
46-
dicttoxml = None
46+
try:
47+
from roundup.dicttoxml import dicttoxml
48+
except ImportError:
49+
try:
50+
# else look in sys.path
51+
from dicttoxml import dicttoxml
52+
except ImportError:
53+
# else not supported
54+
dicttoxml = None
4755

4856
# Py3 compatible basestring
4957
try:

0 commit comments

Comments
 (0)