Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/olpc/datastore/datastore.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/olpc/datastore/datastore.py')
-rw-r--r--src/olpc/datastore/datastore.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/olpc/datastore/datastore.py b/src/olpc/datastore/datastore.py
index f5862cf..bf3cfaf 100644
--- a/src/olpc/datastore/datastore.py
+++ b/src/olpc/datastore/datastore.py
@@ -404,13 +404,25 @@ class DataStore(dbus.service.Object):
#@utils.sanitize_dbus
@dbus.service.method(DS_DBUS_INTERFACE,
in_signature='s',
- out_signature='s')
- def get_filename(self, uid):
+ out_signature='s',
+ sender_keyword='sender')
+ def get_filename(self, uid, sender=None):
content = self.get(uid)
if content:
- try: return content.filename
- except AttributeError: pass
- return ''
+ # Assign to the backing store the uid of the process that called
+ # this method. This is needed for copying the file in the right
+ # place.
+ backingstore = content.backingstore
+ backingstore.current_user_id = dbus.Bus().get_unix_user(sender)
+ try:
+ # Retrieving the file path for the file will cause the file to be
+ # copied or linked to a directory accessible by the caller.
+ file_path = content.filename
+ except AttributeError:
+ file_path = ''
+ finally:
+ backingstore.current_user_id = None
+ return file_path
#@utils.sanitize_dbus
@dbus.service.method(DS_DBUS_INTERFACE,