[Sugar-devel] [PATCH][sugar] Model._get_mount_point loops forever

Martin Abente martin.abente.lahaye at gmail.com
Thu Jun 9 12:11:10 EDT 2011


Fixes the stop condition, so it won't loop forever when
the object_id belongs to the local FS. In that case, it will
return "None" to avoid ambiguity with what we refer to "/".

Signed-off-by: Martin Abente <martin.abente.lahaye at gmail.com>
---
 src/jarabe/journal/model.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index fd25681..4094fe6 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -530,11 +530,12 @@ def find(query_, page_size):
 
 def _get_mount_point(path):
     dir_path = os.path.dirname(path)
-    while True:
+    while dir_path:
         if os.path.ismount(dir_path):
             return dir_path
         else:
             dir_path = dir_path.rsplit(os.sep, 1)[0]
+    return None
 
 
 def get(object_id):
-- 
1.7.4.4



More information about the Sugar-devel mailing list