BIND 10 trac714, updated. 9e72b16bcbfcdc819cbdc437feb10f73b1694107 [trac714] allow non-strict json decoding

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jun 30 10:19:29 UTC 2011


The branch, trac714 has been updated
       via  9e72b16bcbfcdc819cbdc437feb10f73b1694107 (commit)
      from  7e41b9c3e2e1ca809ed4ea6de67c843a1a0d7680 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9e72b16bcbfcdc819cbdc437feb10f73b1694107
Author: Jelte Jansen <jelte at isc.org>
Date:   Thu Jun 30 11:51:13 2011 +0200

    [trac714] allow non-strict json decoding
    
    i.e. allow control-chars in strings

-----------------------------------------------------------------------

Summary of changes:
 src/lib/python/isc/cc/message.py            |    2 +-
 src/lib/python/isc/cc/tests/message_test.py |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/cc/message.py b/src/lib/python/isc/cc/message.py
index 3601c41..3ebcc43 100644
--- a/src/lib/python/isc/cc/message.py
+++ b/src/lib/python/isc/cc/message.py
@@ -35,7 +35,7 @@ def from_wire(data):
        Raises an AttributeError if the given object has no decode()
        method (which should return a string).
        '''
-    return json.loads(data.decode('utf8'))
+    return json.loads(data.decode('utf8'), strict=False)
 
 if __name__ == "__main__":
     import doctest
diff --git a/src/lib/python/isc/cc/tests/message_test.py b/src/lib/python/isc/cc/tests/message_test.py
index 2024201..c417068 100644
--- a/src/lib/python/isc/cc/tests/message_test.py
+++ b/src/lib/python/isc/cc/tests/message_test.py
@@ -31,6 +31,10 @@ class MessageTest(unittest.TestCase):
         self.msg2_str = "{\"aaa\": [1, 1.1, true, false, null]}";
         self.msg2_wire = self.msg2_str.encode()
 
+        self.msg3 = { "aaa": [ 1, 1.1, True, False, "string\n" ] }
+        self.msg3_str = "{\"aaa\": [1, 1.1, true, false, \"string\n\" ]}";
+        self.msg3_wire = self.msg3_str.encode()
+
     def test_encode_json(self):
         self.assertEqual(self.msg1_wire, isc.cc.message.to_wire(self.msg1))
         self.assertEqual(self.msg2_wire, isc.cc.message.to_wire(self.msg2))
@@ -40,6 +44,7 @@ class MessageTest(unittest.TestCase):
     def test_decode_json(self):
         self.assertEqual(self.msg1, isc.cc.message.from_wire(self.msg1_wire))
         self.assertEqual(self.msg2, isc.cc.message.from_wire(self.msg2_wire))
+        self.assertEqual(self.msg3, isc.cc.message.from_wire(self.msg3_wire))
 
         self.assertRaises(AttributeError, isc.cc.message.from_wire, 1)
         self.assertRaises(ValueError, isc.cc.message.from_wire, b'\x001')




More information about the bind10-changes mailing list