Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Silbe <sascha-pgp@silbe.org>2011-04-10 18:46:07 (GMT)
committer Sascha Silbe <sascha-pgp@silbe.org>2011-04-10 18:46:07 (GMT)
commitd2d26fdabd2b2ac27bf86d37f6b0beca865718ac (patch)
tree789841b156be076eeec2cde248a1a59c49ebd27d
parent24f58d5129e050f5532bcec41037f904ea3fddf3 (diff)
Fix D-Bus marshalling of (byte) strings.
D-Bus transmits Python (byte) strings as D-Bus (character) strings by default, so we need to explicitly convert them to D-Bus ByteArrays.
-rw-r--r--src/gdatastore/datastore.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gdatastore/datastore.py b/src/gdatastore/datastore.py
index 57f6bdf..1cb8555 100644
--- a/src/gdatastore/datastore.py
+++ b/src/gdatastore/datastore.py
@@ -278,11 +278,12 @@ class InternalApi(object):
options)
#logging.debug('object_ids=%r', object_ids)
property_names = options.pop('metadata', None)
- if property_names:
- for entry in entries:
- for name in entry.keys():
- if name not in property_names:
- del entry[name]
+ for entry in entries:
+ for name in entry.keys():
+ if property_names and name not in property_names:
+ del entry[name]
+ elif isinstance(entry[name], str):
+ entry[name] = dbus.ByteArray(entry[name])
return entries, total_count