[Dextrose] [sugar PATCH] sl#3605: Do not rely on 'mountpoint' property being present in the metadata per entry. Instead use the global API.

Ajay Garg ajay at activitycentral.com
Wed May 16 09:50:08 EDT 2012


Please note, that the global API ("get_mount_point()" and "set_mount_point()") were
introduced as a part of batch-operations feature, for which the patch is located at ::
http://patchwork.sugarlabs.org/patch/1205/

Also, since the bug has been diagnosed on sugar-mainline master (on which the batch-operations
patch has not been pushed, yet ;-) ), so this (ticket sl#3605) does not seem to be a 
regression; it seems to be genuinely present right from the start.

 src/jarabe/journal/model.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index 527f78d..1f042db 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -1003,7 +1003,13 @@ def is_editable(metadata):
     if metadata.get('mountpoint', '/') == '/':
         return True
     else:
-        return os.access(metadata['mountpoint'], os.W_OK)
+        # sl#3605: Instead of relying on mountpoint property being
+        #          present in the metadata, use journalactivity api.
+        #          This would work seamlessly, as "Details View' is
+        #          called, upon an entry in the context of a singular
+        #          mount-point.
+        from jarabe.journal.journalactivity import get_mount_point
+        return os.access(get_mount_point(), os.W_OK)
 
 
 def get_documents_path():
-- 
1.7.4.4



More information about the Dextrose mailing list