From 4bda8f3bfdf51979e8ba970e3581a234247356a7 Mon Sep 17 00:00:00 2001 From: malei Date: Sun, 25 Mar 2018 18:06:09 +0800 Subject: [PATCH] Use http code constant instead of int To keep the consistency, using http_client.ACCEPTED instead of 202 Change-Id: I9c1a5dedfe0cf1a34224727284b3531b17ea9c1c --- meteos/api/openstack/wsgi.py | 4 ++-- meteos/api/v1/datasets.py | 3 ++- meteos/api/v1/experiments.py | 3 ++- meteos/api/v1/learnings.py | 3 ++- meteos/api/v1/model_evaluations.py | 3 ++- meteos/api/v1/models.py | 3 ++- meteos/api/v1/templates.py | 3 ++- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/meteos/api/openstack/wsgi.py b/meteos/api/openstack/wsgi.py index 107bdf3..a8dd346 100644 --- a/meteos/api/openstack/wsgi.py +++ b/meteos/api/openstack/wsgi.py @@ -1225,7 +1225,7 @@ class AdminActionsMixin(object): self._update(context, id, update) except exception.NotFound as e: raise webob.exc.HTTPNotFound(six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) @Controller.authorize('force_delete') def _force_delete(self, req, id, body): @@ -1236,7 +1236,7 @@ class AdminActionsMixin(object): except exception.NotFound as e: raise webob.exc.HTTPNotFound(six.text_type(e)) self._delete(context, resource, force=True) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) class Fault(webob.exc.HTTPException): diff --git a/meteos/api/v1/datasets.py b/meteos/api/v1/datasets.py index 9ec9981..4ac400d 100644 --- a/meteos/api/v1/datasets.py +++ b/meteos/api/v1/datasets.py @@ -18,6 +18,7 @@ from oslo_log import log import six +from six.moves import http_client import webob from webob import exc @@ -66,7 +67,7 @@ class DatasetController(wsgi.Controller, wsgi.AdminActionsMixin): except exception.InvalidLearning as e: raise exc.HTTPForbidden(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def index(self, req): """Returns a summary list of datasets.""" diff --git a/meteos/api/v1/experiments.py b/meteos/api/v1/experiments.py index 088a4ab..1ad8232 100644 --- a/meteos/api/v1/experiments.py +++ b/meteos/api/v1/experiments.py @@ -18,6 +18,7 @@ from oslo_log import log import six +from six.moves import http_client import webob from webob import exc @@ -66,7 +67,7 @@ class ExperimentController(wsgi.Controller, wsgi.AdminActionsMixin): except exception.InvalidLearning as e: raise exc.HTTPForbidden(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def index(self, req): """Returns a summary list of experiments.""" diff --git a/meteos/api/v1/learnings.py b/meteos/api/v1/learnings.py index 2c7aaee..e769826 100644 --- a/meteos/api/v1/learnings.py +++ b/meteos/api/v1/learnings.py @@ -18,6 +18,7 @@ from oslo_log import log import six +from six.moves import http_client import webob from webob import exc @@ -66,7 +67,7 @@ class LearningController(wsgi.Controller, wsgi.AdminActionsMixin): except exception.InvalidLearning as e: raise exc.HTTPForbidden(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def index(self, req): """Returns a summary list of learnings.""" diff --git a/meteos/api/v1/model_evaluations.py b/meteos/api/v1/model_evaluations.py index 0b9ef35..db819b2 100644 --- a/meteos/api/v1/model_evaluations.py +++ b/meteos/api/v1/model_evaluations.py @@ -18,6 +18,7 @@ from oslo_log import log import six +from six.moves import http_client import webob from webob import exc @@ -67,7 +68,7 @@ class ModelEvaluationController(wsgi.Controller, wsgi.AdminActionsMixin): except exception.InvalidLearning as e: raise exc.HTTPForbidden(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def index(self, req): """Returns a summary list of model evaluations.""" diff --git a/meteos/api/v1/models.py b/meteos/api/v1/models.py index 788af61..31da361 100644 --- a/meteos/api/v1/models.py +++ b/meteos/api/v1/models.py @@ -18,6 +18,7 @@ from oslo_log import log import six +from six.moves import http_client import webob from webob import exc @@ -177,7 +178,7 @@ class ModelController(wsgi.Controller, ModelMixin, wsgi.AdminActionsMixin): except exception.InvalidLearning as e: raise exc.HTTPForbidden(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def index(self, req): """Returns a summary list of models.""" diff --git a/meteos/api/v1/templates.py b/meteos/api/v1/templates.py index 5a5f71c..4933295 100644 --- a/meteos/api/v1/templates.py +++ b/meteos/api/v1/templates.py @@ -18,6 +18,7 @@ from oslo_log import log import six +from six.moves import http_client import webob from webob import exc @@ -64,7 +65,7 @@ class TemplateController(wsgi.Controller, wsgi.AdminActionsMixin): except exception.InvalidLearning as e: raise exc.HTTPForbidden(explanation=six.text_type(e)) - return webob.Response(status_int=202) + return webob.Response(status_int=http_client.ACCEPTED) def index(self, req): """Returns a summary list of templates."""