diff options
author | Dan Williams <dcbw@redhat.com> | 2006-06-19 18:52:46 (GMT) |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2006-06-19 18:52:46 (GMT) |
commit | 69c1fd62527467e7351da3b015ccfe06a389a81f (patch) | |
tree | c64e003d0e403326c116f48172fcac2b0f36cdf5 /sugar | |
parent | 73c94c7bfbc427ad9880c6a6910259c55e485dac (diff) |
Ensure properties arguments are local encoding (for now)
Diffstat (limited to 'sugar')
-rw-r--r-- | sugar/presence/Service.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sugar/presence/Service.py b/sugar/presence/Service.py index 330bfd0..e1232f6 100644 --- a/sugar/presence/Service.py +++ b/sugar/presence/Service.py @@ -184,13 +184,23 @@ class Service(object): TXT record (a list of lists of integers), or a python dictionary.""" self._properties = {} + props = {} if type(properties) == type([]): - self._properties = _txt_to_dict(properties) + props = _txt_to_dict(properties) elif type(properties) == type({}): - self._properties = properties - for key, value in self._properties.items(): - if type(self._properties[key]) == type(u""): - self._properties[key] = self._properties[key].encode() + props = properties + + # Set key/value pairs on internal property list, + # also convert everything to local encoding (for now) + # to ensure consistency + for key, value in props.items(): + tmp_key = key + tmp_val = value + if type(tmp_key) == type(u""): + tmp_key = tmp_key.encode() + if type(tmp_val) == type(u""): + tmp_val = tmp_val.encode() + self._properties[tmp_key] = tmp_val def get_type(self): """Return the service's service type without any activity identifiers.""" |