Re: REST-API: Merging/Rebasing with Mercurial?
"John P. Rouillard" <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Ralf: In message <[email protected]>, Ralf Schlatterbeck writes: >OK, I managed to convert the changes from the repo converted from git >to a patchset using mq and apply this to a fresh SF checkout. Then I >merged the branch and pushed the result. > >To make a long story short: >- Roundup now has a REST API from the 2015 GSOC implemented by Chau > Nguyen and mentored by Ezio Melotti Nice work. Very happy to see this get merged. I updated one of my trackers and tried out the rest interface. I am running under python 2 with version 75cfee324d00. Using curl: $ curl -u admin -p https://uland/sysadmin/rest/data/issue/1 Enter host password for user 'admin': I get: ==== {"data": {"link": "http://uland/sysadmin/rest/data/issue/1", "type": "issue", "id": "1", "attributes": {"status": "4", "billinfo": null, "dependson": [], "blockedby": ["2"], "actiondate": null, "startdate": null, "group": [], "title": "New title", "priority": "4", "superseder": [], "duedate": "2017-12-08.05:00:00", "files": ["5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17"], "actionclearonmessage": false, "fyi": null, "timelog": ["13", "15", "16", "22", "40"], "actionstatus": null, "assignedto": "6", "private": false, "needsreply": true, "requestedby": "1", "seealso": ["3"], "actioncomment": null, "keyword": ["6", "17"], "verynosy": ["8", "6"], "nosy": ["1"], "messages": ["1", "3", "132", "134", "147", "158", "159", "165", "166", "167", "170", "171", "172", "175", "1 76", "177", "181", "182", "185", "188", "191", "194", "197", "199", "201", "203", "205", "207", "217", "224", "231", "232", "233", "262", "280", "281", "282", "393", "416", "417", "419", "420", "483", "484", "485", "488", "511", "512", "515"], "queue": "3", "workingorder": null, "leadtime": null}}} ==== as expected. However if I intentionally mistype the password, I get: ==== EXCEPTION AT Thu Jan 31 01:22:24 2019 Traceback (most recent call last): File "roundup/scripts/roundup_server.py", line 222, in run_cgi tracker.Client(tracker, self, env).main() File "/home/rouilj/develop/roundup.sysadmin/roundup/cgi/client.py", line 436, in main self.handle_rest() File "/home/rouilj/develop/roundup.sysadmin/roundup/cgi/client.py", line 499, in handle_rest self.determine_user() File "/home/rouilj/develop/roundup.sysadmin/roundup/cgi/client.py", line 892, in determine_user login.verifyLogin(username, password) File "/home/rouilj/develop/roundup.sysadmin/roundup/cgi/actions.py", line 1270, in verifyLogin raise exceptions.LoginError(self._('Invalid login')) LoginError: Invalid login <body bgcolor="white"><font color="white" size="-5"> > </font> </table></table></table></table></table><p>Thu Jan 31 01:22:24 2019: An error occurred. Please check the server log for more information.</p> ==== This is with [web] debug turned off in config.ini. Maybe a missing try somewhere? Also if I try the url: https://uland/sysadmin/rest/data/file/5 I get another exception: EXCEPTION AT Thu Jan 31 01:39:48 2019 Traceback (most recent call last): File "roundup/scripts/roundup_server.py", line 222, in run_cgi self.inner_run_cgi() File "roundup/scripts/roundup_server.py", line 457, in inner_run_cgi tracker.Client(tracker, self, env).main() File "/home/rouilj/develop/roundup.sysadmin/roundup/cgi/client.py", line 436, in main self.handle_rest() File "/home/rouilj/develop/roundup.sysadmin/roundup/cgi/client.py", line 505, in handle_rest self.form) File "/home/rouilj/develop/roundup.sysadmin/roundup/rest.py", line 1167, in dispatch output = RoundupJSONEncoder(indent=indent).encode(output) File "/usr/lib/python2.7/json/encoder.py", line 207, in encode chunks = self.iterencode(o, _one_shot=True) File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode return _iterencode(o, 0) UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0: invalid start byte <body bgcolor="white"><font color="white" size="-5"> > </font> </table></table></table></table></table><p>Thu Jan 31 01:39:48 2019: An error occurred. Please check the server log for more information.</p> file5 is a jpeg image, so not utf8 parsible. roundup-admin reports: acl: none name: cover.jpg status: None type: image/jpeg So checking the type for text/ before trying to interpret it as utf8 should work. I am not sure how you encode binary data into json so you can return the image. A normal text file works: {"data": {"link": "http://uland/sysadmin/rest/data/file/9", "type": "file", "id": "9", "attributes": {"content": "personal_repl-1.1 en 0 \nrequestor requester\n", "status": null, "type": "application/octet-stream", "name": ".aspell.en.prepl", "acl": null}}} So far retreiving msg also work fine. I look forward to updated docs. Thanks again and have a great week. -- -- rouilj John Rouillard =========================================================================== My employers don't acknowledge my existence much less my opinions.