changeset 9c47c389f87c in tryton-tools:default
details: https://hg.tryton.org/tryton-tools?cmd=changeset;node=9c47c389f87c
description:
Update reviewbot to work with roundup 1.6.0
diffstat:
reviewbot.py | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r 4806d3d8ffe0 -r 9c47c389f87c reviewbot.py
--- a/reviewbot.py Fri Nov 09 19:16:06 2018 +0100
+++ b/reviewbot.py Sun Feb 17 12:17:43 2019 +0100
@@ -21,7 +21,7 @@
ISSUE_FORMAT = re.compile(
r'(?:#|\bissue|\bbug)\s*(?P<issue_id>[0-9]{4,})', re.I)
CODEREVIEW_URL = 'https://codereview.tryton.org'
-ROUNDUP_URL = 'https://roundup-xmlrpc.tryton.org'
+ROUNDUP_URL = 'https://bugs.tryton.org/'
REPOSITORY_URL = 'https://hg.tryton.org/'
MODULE_REPOSITORY_URL = REPOSITORY_URL + 'modules/'
DB_PATH = os.path.expanduser('~/.reviewbot.db')
@@ -35,10 +35,20 @@
def get_roundup(url, username, password):
- parts = list(urllib.parse.urlsplit(url))
+ class SpecialTransport(xmlrpc.client.SafeTransport):
+ def send_headers(self, connection, headers):
+ headers += [
+ ('Referer', url),
+ ('Origin', url.rstrip('/')),
+ ('X-Requested-With', 'XMLHttpRequest'),
+ ]
+ super().send_headers(connection, headers)
+
+ parts = list(urllib.parse.urlsplit(url + 'xmlrpc'))
parts[1] = '%s:%s@%s' % (username, password, parts[1])
- url = urllib.parse.urlunsplit(parts)
- return xmlrpc.client.ServerProxy(url, allow_none=True)
+ url_full = urllib.parse.urlunsplit(parts)
+ return xmlrpc.client.ServerProxy(
+ url_full, transport=SpecialTransport(), allow_none=True)
class RietveltStyle(pep8.StyleGuide):