Web · Wiki · Activities · Blog · Lists · Chat · Meeting · Bugs · Git · Translate · Archive · People · Donate

Commit 23164d7f0d0ce69556225315f1c2989780576f7b

Fix handling of non-ASCII data paths

For the native interface, we switch to using byte arrays, which is the
only sane way to handle paths on POSIX file systems.

For the Sugar v2 interface, we assume UTF-8 representation, like Sugar
does.
  
116116 pass
117117
118118 @dbus.service.method(DBUS_INTERFACE_NATIVE_V1,
119 in_signature='a{sv}s', out_signature='ss',
119 in_signature='a{sv}ay', out_signature='ss',
120120 async_callbacks=('async_cb', 'async_err_cb'),
121121 byte_arrays=True)
122122 def create(self, metadata, data_path, async_cb, async_err_cb):
127127 """
128128 # TODO: what about transfer_ownership/delete_after?
129129 self._internal_api.save(tree_id='', parent_id='', metadata=metadata,
130 path=data_path, delete_after=True,
130 path=data_path,
131 delete_after=True,
131132 async_cb=async_cb,
132133 async_err_cb=async_err_cb)
133134
153153 async_err_cb=async_err_cb)
154154
155155 @dbus.service.method(DBUS_INTERFACE_NATIVE_V1,
156 in_signature='ssa{sv}s', out_signature='s',
156 in_signature='ssa{sv}ay', out_signature='s',
157157 async_callbacks=('async_cb', 'async_err_cb'),
158158 byte_arrays=True)
159159 def add_version(self, tree_id, parent_id, metadata, data_path, async_cb,
170170 if not parent_id:
171171 raise ValueError('No parent_id given')
172172
173 self._internal_api.save(tree_id, parent_id, metadata, data_path,
173 self._internal_api.save(tree_id, parent_id, metadata,
174 data_path,
174175 delete_after=True,
175176 async_cb=success_cb,
176177 async_err_cb=async_err_cb)
229229 return self._internal_api.find(query_dict, options)
230230
231231 @dbus.service.method(DBUS_INTERFACE_NATIVE_V1,
232 in_signature='ss', out_signature='s',
232 in_signature='ss', out_signature='ay',
233233 sender_keyword='sender')
234234 def get_data_path(self, tree_id, version_id, sender=None):
235235 object_id = (tree_id, version_id)
256256 return self._internal_api.find(query_dict, options, query_string)
257257
258258 @dbus.service.method(DBUS_INTERFACE_NATIVE_V1,
259 in_signature='sssa{sv}s', out_signature='ss',
259 in_signature='sssa{sv}ay', out_signature='ss',
260260 async_callbacks=('async_cb', 'async_err_cb'),
261261 byte_arrays=True)
262262 def restore(self, tree_id, parent_id, version_id, metadata, data_path,
340340 async_cb(tree_id)
341341
342342 self._internal_api.save(tree_id='', parent_id='', metadata=props,
343 path=file_path,
343 path=file_path.encode('utf-8'),
344344 delete_after=transfer_ownership,
345345 async_cb=success_cb,
346346 async_err_cb=async_err_cb)
372372
373373 self._internal_api.save(tree_id=uid,
374374 parent_id=parent['version_id'], metadata=props,
375 path=file_path, delete_after=transfer_ownership,
375 path=file_path.encode('utf-8'), delete_after=transfer_ownership,
376376 async_cb=success_cb, async_err_cb=async_err_cb)
377377
378378 @dbus.service.signal(DBUS_INTERFACE_SUGAR_V2, signature='s')