From c560e71d91b8fadd8923e9d61e29c2177bdf8635 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Mon, 19 Oct 2015 16:13:44 -0700 Subject: [PATCH] Remove failure version number Version numbering with this object has not currently been useful, and we should do our best to make all changes backwards compatible anyway so the usage of a version number is not benefical at this time. Change-Id: I87bcc30dd19dc9a8d3c3d7bce2174e13c4a22634 --- taskflow/tests/unit/test_failure.py | 8 -------- taskflow/types/failure.py | 10 ---------- 2 files changed, 18 deletions(-) diff --git a/taskflow/tests/unit/test_failure.py b/taskflow/tests/unit/test_failure.py index bad99456..4ecaa83c 100644 --- a/taskflow/tests/unit/test_failure.py +++ b/taskflow/tests/unit/test_failure.py @@ -152,14 +152,6 @@ class FailureObjectTestCase(test.TestCase): } self.assertRaises(exceptions.InvalidFormat, failure.Failure.validate, f) - f = { - 'exception_str': 'blah', - 'traceback_str': 'blah', - 'exc_type_names': ['Exception'], - 'version': -1, - } - self.assertRaises(exceptions.InvalidFormat, - failure.Failure.validate, f) def test_valid_from_dict_to_dict(self): f = _captured_failure('Woot!') diff --git a/taskflow/types/failure.py b/taskflow/types/failure.py index 72f3710f..91cd4903 100644 --- a/taskflow/types/failure.py +++ b/taskflow/types/failure.py @@ -121,7 +121,6 @@ class Failure(mixins.StrMixin): backport at https://pypi.python.org/pypi/traceback2/ to (hopefully) simplify the methods and contents of this object... """ - DICT_VERSION = 1 BASE_EXCEPTIONS = ('BaseException', 'Exception') """ @@ -137,10 +136,6 @@ class Failure(mixins.StrMixin): "cause": { "type": "object", 'properties': { - 'version': { - "type": "integer", - "minimum": 0, - }, 'exception_str': { "type": "string", }, @@ -467,10 +462,6 @@ class Failure(mixins.StrMixin): def from_dict(cls, data): """Converts this from a dictionary to a object.""" data = dict(data) - version = data.pop('version', None) - if version != cls.DICT_VERSION: - raise ValueError('Invalid dict version of failure object: %r' - % version) causes = data.get('causes') if causes is not None: data['causes'] = tuple(cls.from_dict(d) for d in causes) @@ -482,7 +473,6 @@ class Failure(mixins.StrMixin): 'exception_str': self.exception_str, 'traceback_str': self.traceback_str, 'exc_type_names': list(self), - 'version': self.DICT_VERSION, 'causes': [f.to_dict() for f in self.causes], }