Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/service
diff options
context:
space:
mode:
authorC. Scott Ananian <cscott@laptop.org>2008-08-13 21:58:05 (GMT)
committer C. Scott Ananian <cscott@laptop.org>2008-08-19 19:29:06 (GMT)
commit5c782cf1a6c5a89943e5dec2a3b5b6d1694b5714 (patch)
tree9724eeed57c2acd5c230c1aa39c485c865423f52 /service
parent1e0673e6104fc8c12ba4e0e6f7d1c82ec88b8e2f (diff)
Filesystem paths should be byte arrays, not unicode sequences. (dlo trac #7733)
Passing a unicode string to os.path.join(x,y) and other functions will attempt to convert all sides of the path to unicode using the ASCII encoding. This will prohibit the use of non-ASCII characters in filenames, which is not what we want! We need all paths passed around internally to be 'str' objects, not 'unicode' objects. Unfortunately, dbus' STRING type enforces UTF-8 encoding. So, we compromise: we use 's' in our dbus signature, but we pass the 'utf8_strings=True' keyword option when we declare our methods, so that the parameters are given to use as 'str' not 'unicode'. These functions will not support filenames which are not UTF-8 encoded.
Diffstat (limited to 'service')
-rw-r--r--service/activityregistryservice.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/service/activityregistryservice.py b/service/activityregistryservice.py
index 6ba5598..c8a8efa 100644
--- a/service/activityregistryservice.py
+++ b/service/activityregistryservice.py
@@ -37,7 +37,8 @@ class ActivityRegistry(dbus.service.Object):
bundle_registry.connect('bundle-changed', self._bundle_changed_cb)
@dbus.service.method(_ACTIVITY_REGISTRY_IFACE,
- in_signature='s', out_signature='b')
+ in_signature='s', out_signature='b',
+ utf8_strings=True)
def AddBundle(self, bundle_path):
'''Register the activity bundle with the global registry
@@ -52,7 +53,8 @@ class ActivityRegistry(dbus.service.Object):
return registry.add_bundle(bundle_path)
@dbus.service.method(_ACTIVITY_REGISTRY_IFACE,
- in_signature='s', out_signature='b')
+ in_signature='s', out_signature='b',
+ utf8_strings=True)
def RemoveBundle(self, bundle_path):
'''Unregister the activity bundle with the global registry