Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/olpc/datastore/backingstore.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/olpc/datastore/backingstore.py')
-rw-r--r--src/olpc/datastore/backingstore.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/olpc/datastore/backingstore.py b/src/olpc/datastore/backingstore.py
index c4af266..bc3905a 100644
--- a/src/olpc/datastore/backingstore.py
+++ b/src/olpc/datastore/backingstore.py
@@ -419,11 +419,20 @@ class FileBackingStore(BackingStore):
return content
def _writeContent_complete(self, path, completion=None):
+ self._set_permissions_if_possible(path)
if completion is None:
return path
completion(None, path)
return None
+ def _set_permissions_if_possible(self, path):
+ try:
+ os.chmod(path, 0604)
+ except OSError, e:
+ # This can fail for usb sticks.
+ if e.errno != errno.EPERM:
+ raise
+
def _writeContent(self, uid, filelike, replace=True, can_move=False, target=None,
completion=None):
"""Returns: path of file in datastore (new path if it was copied/moved)"""
@@ -440,10 +449,12 @@ class FileBackingStore(BackingStore):
# protection on inplace stores
if completion is None:
bin_copy.bin_copy(filelike.name, path)
+ self._set_permissions_if_possible(path)
return path
if can_move:
bin_copy.bin_mv(filelike.name, path)
+ self._set_permissions_if_possible(path)
return self._writeContent_complete(path, completion)
# Otherwise, async copy