remove Python 2.5 compatability
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
language: python
|
language: python
|
||||||
python:
|
python:
|
||||||
- "2.5"
|
|
||||||
- "2.6"
|
- "2.6"
|
||||||
- "2.7"
|
- "2.7"
|
||||||
- "3.2"
|
- "3.2"
|
||||||
|
|||||||
23
jsonpatch.py
23
jsonpatch.py
@@ -43,10 +43,7 @@ __license__ = 'Modified BSD License'
|
|||||||
import copy
|
import copy
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if sys.version_info < (2, 6):
|
import json
|
||||||
import simplejson as json
|
|
||||||
else:
|
|
||||||
import json
|
|
||||||
|
|
||||||
import jsonpointer
|
import jsonpointer
|
||||||
|
|
||||||
@@ -352,13 +349,8 @@ class RemoveOperation(PatchOperation):
|
|||||||
subobj, part = self.pointer.to_last(obj)
|
subobj, part = self.pointer.to_last(obj)
|
||||||
try:
|
try:
|
||||||
del subobj[part]
|
del subobj[part]
|
||||||
except KeyError:
|
except KeyError as ex:
|
||||||
exc_info = sys.exc_info()
|
raise JsonPatchConflict(str(ex))
|
||||||
exc = JsonPatchConflict(str(exc_info[1]))
|
|
||||||
if sys.version_info >= (3, 0):
|
|
||||||
raise exc.with_traceback(exc_info[2])
|
|
||||||
else:
|
|
||||||
raise exc
|
|
||||||
|
|
||||||
|
|
||||||
class AddOperation(PatchOperation):
|
class AddOperation(PatchOperation):
|
||||||
@@ -439,13 +431,8 @@ class TestOperation(PatchOperation):
|
|||||||
else:
|
else:
|
||||||
val = self.pointer.walk(subobj, part)
|
val = self.pointer.walk(subobj, part)
|
||||||
|
|
||||||
except JsonPointerException:
|
except JsonPointerException as ex:
|
||||||
exc_info = sys.exc_info()
|
raise JsonPatchTestFailed(str(ex))
|
||||||
exc = JsonPatchTestFailed(str(exc_info[1]))
|
|
||||||
if sys.version_info >= (3, 0):
|
|
||||||
raise exc.with_traceback(exc_info[2])
|
|
||||||
else:
|
|
||||||
raise exc
|
|
||||||
|
|
||||||
if 'value' in self.operation:
|
if 'value' in self.operation:
|
||||||
value = self.operation['value']
|
value = self.operation['value']
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
simplejson #required for Python 2.5 compatability
|
|
||||||
jsonpointer>=0.5
|
jsonpointer>=0.5
|
||||||
|
|||||||
Reference in New Issue
Block a user