From: Dan Wendlandt Date: Fri, 9 Sep 2011 15:59:55 +0000 (-0700) Subject: merge salv's branch for bug834013 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=9ab9129ba25c77c08b2b51608241201384bd0d13;p=openstack-build%2Fneutron-build.git merge salv's branch for bug834013 --- 9ab9129ba25c77c08b2b51608241201384bd0d13 diff --cc quantum/api/api_common.py index 6f0f5477e,8b0fa0e62..0fb68696e --- a/quantum/api/api_common.py +++ b/quantum/api/api_common.py @@@ -59,5 -60,23 +60,24 @@@ class QuantumController(wsgi.Controller LOG.error(line) raise exc.HTTPBadRequest(msg) results[param_name] = param_value or param.get('default-value') + return results + + def _build_response(self, req, res_data, status_code=200): + """ A function which builds an HTTP response + given a status code and a dictionary containing + the response body to be serialized + + """ + content_type = req.best_match_content_type() + default_xmlns = self.get_default_xmlns(req) + body = self._serialize(res_data, content_type, default_xmlns) + + response = webob.Response() + response.status = status_code + response.headers['Content-Type'] = content_type + response.body = body + msg_dict = dict(url=req.url, status=response.status_int) + msg = _("%(url)s returned with HTTP %(status)d") % msg_dict + LOG.debug(msg) + return response