[Dextrose] Fwd: [PATCH][sugar] Model._get_mount_point loops forever

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


---------- Forwarded message ----------
From: Martin Abente <martin.abente.lahaye at gmail.com>
Date: Thu, Jun 9, 2011 at 12:11 PM
Subject: [PATCH][sugar] Model._get_mount_point loops forever
To: sugar-devel at lists.sugarlabs.org, walter at sugarlabs.org
Cc: Martin Abente <martin.abente.lahaye at gmail.com>


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 Dextrose mailing list