From 5117b02bc492db47c07f9b62ce9abc04142b1d38 Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Mon, 16 Mar 2015 17:49:13 +0100 Subject: [PATCH] fix for bad PR #1584 Signed-off-by: Pierre Tardy --- master/buildbot/data/base.py | 3 +++ master/buildbot/data/resultspec.py | 4 ++++ master/buildbot/test/unit/test_www_rest.py | 4 +++- master/buildbot/www/rest.py | 6 +++--- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/master/buildbot/data/base.py b/master/buildbot/data/base.py index f2b8b91f061..7276dfafc9f 100644 --- a/master/buildbot/data/base.py +++ b/master/buildbot/data/base.py @@ -88,6 +88,9 @@ def control(self, action, args, kwargs): def startConsuming(self, callback, options, kwargs): raise NotImplementedError + def __repr__(self): + return "endpoint for" + self.pathPatterns + class BuildNestingMixin(object): diff --git a/master/buildbot/data/resultspec.py b/master/buildbot/data/resultspec.py index 720b1db6f82..50f833c67c4 100644 --- a/master/buildbot/data/resultspec.py +++ b/master/buildbot/data/resultspec.py @@ -75,6 +75,10 @@ def __init__(self, filters=None, fields=None, order=None, self.limit = limit self.offset = offset + def __repr__(self): + return "ResultSpec(**" + repr(dict(filters=self.filters, fields=self.fields, order=self.order, + limit=self.limit, offset=self.offset)) + ")" + def popFilter(self, field, op): for f in self.filters: if f.field == field and f.op == op: diff --git a/master/buildbot/test/unit/test_www_rest.py b/master/buildbot/test/unit/test_www_rest.py index bc5bd5fc25e..253187ad4b7 100644 --- a/master/buildbot/test/unit/test_www_rest.py +++ b/master/buildbot/test/unit/test_www_rest.py @@ -452,7 +452,9 @@ def test_api_details(self): def test_api_details_none(self): yield self.render_resource(self.rsrc, '/test/0') self.assertRequest( - contentJson=dict(error="not found"), + contentJson=dict(error="not found while getting from endpoint for/test/n:testid with arguments" + " ResultSpec(**{'fields': None, 'limit': None, 'order': None, 'filters': [], " + "'offset': None}) and {'testid': 0}"), contentType='text/plain; charset=utf-8', responseCode=404) diff --git a/master/buildbot/www/rest.py b/master/buildbot/www/rest.py index b734a0a00dc..ed3b83056fd 100644 --- a/master/buildbot/www/rest.py +++ b/master/buildbot/www/rest.py @@ -308,9 +308,9 @@ def writeError(msg, errcode=404, jsonrpccode=None): rspec = self.decodeResultSpec(request, ep) data = yield ep.get(rspec, kwargs) if data is None: - writeError(("not found while getting from endpoint %s with " - "arguments %s and %s") % (str(ep), str(rspec), - str(kwargs)), errcode=404) + writeError(("not found while getting from %s with " + "arguments %s and %s") % (repr(ep), repr(rspec), + str(kwargs)), errcode=404) return if ep.isRaw: