Skip to content

Commit 427fe08

Browse files
committed
Better wording.
1 parent 06cda33 commit 427fe08

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

jsonpatch.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,11 +553,16 @@ def __init__(self, patch, pointer_cls=JsonPointer):
553553
self.patch = patch
554554
self.pointer_cls = pointer_cls
555555

556+
556557
# Verify that the structure of the patch document
557558
# is correct by retrieving each patch element.
558559
# Much of the validation is done in the initializer
559560
# though some is delayed until the patch is applied.
560561
for op in self.patch:
562+
if isinstance(op, basestring):
563+
raise InvalidJsonPatch("Document is expected to be sequence of "
564+
"operations, got a sequence of strings.")
565+
561566
self._get_operation(op)
562567

563568
def __str__(self):
@@ -671,8 +676,6 @@ def apply(self, obj, in_place=False):
671676
return obj
672677

673678
def _get_operation(self, operation):
674-
if isinstance(operation, basestring):
675-
raise InvalidJsonPatch("Operation is expected to be a mapping, got a string.")
676679
if 'op' not in operation:
677680
raise InvalidJsonPatch("Operation does not contain 'op' member")
678681

0 commit comments

Comments
 (0)