Mercurial > p > roundup > code
diff roundup/rest.py @ 5617:38b7c4693d9a
Original code supported setting accept type to json (or other
supported type) by including an extension in the url. So
.../issue.json would return json and .../issue.xml would return xml
response (if xml response were supported). This code strips the
extension from the uri one it has been processed.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 16 Feb 2019 15:29:18 -0500 |
| parents | aa4c271514ae |
| children | 1ad3881fc683 |
line wrap: on
line diff
--- a/roundup/rest.py Sat Feb 16 15:24:53 2019 -0500 +++ b/roundup/rest.py Sat Feb 16 15:29:18 2019 -0500 @@ -1126,6 +1126,11 @@ ext_type = os.path.splitext(urlparse(uri).path)[1][1:] data_type = ext_type or accept_type or self.__default_accept_type + if ( ext_type ): + # strip extension so uri make sense + .../issue.json -> .../issue + uri = uri[:-( len(ext_type) + 1 )] + # check for pretty print try: pretty_output = input['pretty'].value.lower() == "true"
