diff options
author | Steve Baker <sbaker@redhat.com> | 2020-09-10 14:04:26 +1200 |
---|---|---|
committer | Steve Baker <sbaker@redhat.com> | 2020-11-19 10:57:11 +1300 |
commit | f408d63adceb6809d9bb62321493cbc0f18d1a20 (patch) | |
tree | 037f381340ae2436b82ac3452f117fd03f7e149a /ironic/api/controllers/base.py | |
parent | 000bc72cc29b8637df496f2e6768281606a27058 (diff) | |
download | ironic-f408d63adceb6809d9bb62321493cbc0f18d1a20.tar.gz |
Expunge the internal version of WSME
This change removes unused code and concludes the conversion of the
REST API from WSME based to plain JSON.
Change-Id: Ib04c759f86d9758b67a75648b5971f5a80c77ecb
Story: 1651346
Task: 10551
Diffstat (limited to 'ironic/api/controllers/base.py')
-rw-r--r-- | ironic/api/controllers/base.py | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/ironic/api/controllers/base.py b/ironic/api/controllers/base.py index eba5cd0a9..3512000de 100644 --- a/ironic/api/controllers/base.py +++ b/ironic/api/controllers/base.py @@ -12,66 +12,13 @@ # License for the specific language governing permissions and limitations # under the License. -import datetime import functools from webob import exc -from ironic.api import types as atypes from ironic.common.i18n import _ -class AsDictMixin(object): - """Mixin class adding an as_dict() method.""" - - def as_dict(self): - """Render this object as a dict of its fields.""" - def _attr_as_pod(attr): - """Return an attribute as a Plain Old Data (POD) type.""" - if isinstance(attr, list): - return [_attr_as_pod(item) for item in attr] - # Recursively evaluate objects that support as_dict(). - try: - return attr.as_dict() - except AttributeError: - return attr - - return dict((k, _attr_as_pod(getattr(self, k))) - for k in self.fields - if hasattr(self, k) - and getattr(self, k) != atypes.Unset) - - -class Base(AsDictMixin): - """Base type for complex types""" - def __init__(self, **kw): - for key, value in kw.items(): - if hasattr(self, key): - setattr(self, key, value) - - def unset_fields_except(self, except_list=None): - """Unset fields so they don't appear in the message body. - - :param except_list: A list of fields that won't be touched. - - """ - if except_list is None: - except_list = [] - - for k in self.as_dict(): - if k not in except_list: - setattr(self, k, atypes.Unset) - - -class APIBase(Base): - - created_at = atypes.wsattr(datetime.datetime, readonly=True) - """The time in UTC at which the object is created""" - - updated_at = atypes.wsattr(datetime.datetime, readonly=True) - """The time in UTC at which the object is updated""" - - @functools.total_ordering class Version(object): """API Version object.""" |