aboutsummaryrefslogtreecommitdiffstats
path: root/examples/xmlpatterns
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-06-04 16:18:28 +0200
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-06-05 07:10:07 +0000
commit75fbc6de0389b7220381e386740051ea0bf97e9b (patch)
tree29ebbb8e58133704e36879b15b41d4f24e6ad369 /examples/xmlpatterns
parentd059b89abf24159205c4b7d9d59cddfd47a42a66 (diff)
Adapt examples to proper QByteArray constructor
After correcting the QByteArray behavior, the available constructors are constraint to bytes, bytearrays, and others QByteArrays. The modified lines are methods that use the modified argument as a QByteArray (interally), that is why we now we transform them: "test value" -> b"test value" Bytes are Python 2 and 3 compatible, so it does not affect the version. The only different change is inside `schema.py` where a change was needed to encode a QByteArray into utf-8. Since this is outside our automated test, I manually test it with Python 2.7.15 and 3.6.3 on Linux. Task-number: PYSIDE-669 Change-Id: I8c12533b482150f4aee3d813dc127eb6b819549b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'examples/xmlpatterns')
-rwxr-xr-xexamples/xmlpatterns/schema/schema.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/xmlpatterns/schema/schema.py b/examples/xmlpatterns/schema/schema.py
index a10cc32ce..4a24e4f30 100755
--- a/examples/xmlpatterns/schema/schema.py
+++ b/examples/xmlpatterns/schema/schema.py
@@ -61,7 +61,7 @@ except NameError:
# Python v3.
def encode_utf8(ba):
- return str(ba, encoding='utf8')
+ return str(ba.data(), encoding='utf8')
def decode_utf8(qs):
return QtCore.QByteArray(bytes(qs, encoding='utf8'))