comparison doc/rest.txt @ 7684:3eca3462ba0c

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.
author John Rouillard <rouilj@ieee.org>
date Thu, 26 Oct 2023 11:24:04 -0400
parents c5307dc0e8c6
children 0e3d31a6b7fd
comparison
equal deleted inserted replaced
7683:b04e222501b8 7684:3eca3462ba0c
309 Response Formats 309 Response Formats
310 ---------------- 310 ----------------
311 311
312 The default response format is json. 312 The default response format is json.
313 313
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
315 data using the header ``Accept: application/xml`` in your 315 data using the header ``Accept: application/xml`` in your
316 request. Both output formats are similar in structure. 316 request. Both output formats are similar in structure.
317 317
318 ``dicttoxml.py`` should be installed in the Python install directory, 318 ``dicttoxml2.py`` should be installed in the Python install directory,
319 or the file can be added to the Roundup installation directory long 319 or the file can be added to the Roundup installation directory along
320 ide ``rest.py``. It can also be enabled on a per tracker basis by 320 side ``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 321 adding ``dicttoxml2.py`` to the lib directory in your tracker home (you
322 may need to create the directory). Then this can be added to 322 may need to create the directory). Then this can be added to
323 `interfaces.py`_ to enable xml:: 323 `interfaces.py`_ to enable xml::
324 324
325 from roundup import rest 325 from roundup import rest
326 from dicttoxml import dicttoxml as dtox # from tracker_root/lib directory 326 from dicttoxml import dicttoxml as dtox # from tracker_root/lib directory
332 The rest interface accepts the http accept header and can include 332 The rest interface accepts the http accept header and can include
333 ``q`` values to specify the preferred mechanism. This is the preferred 333 ``q`` values to specify the preferred mechanism. This is the preferred
334 way to specify alternate acceptable response formats. 334 way to specify alternate acceptable response formats.
335 335
336 To make testing from the browser easier, you can also append the 336 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
338 will force json or xml (if supported) output. If you use an extension 338 will force json or xml (if supported) output. If you use an extension
339 it takes priority over any accept headers. 339 it takes priority over any accept headers.
340 340
341 The rest interface returns status 406 if you use an unrecognized 341 The rest interface returns status 406 if you use an unrecognized
342 extension. You will also get a 406 status if none of the entries in 342 extension. You will also get a 406 status if none of the entries in
343 the accept header are available or if the accept header is invalid. 343 the accept header are available or if the accept header is invalid.
344
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``.
344 348
345 349
346 General Guidelines 350 General Guidelines
347 ------------------ 351 ------------------
348 352

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