[Calypso] [PATCH] Break endless loop

Guido Günther agx at sigxcpu.org
Tue Jan 26 11:25:47 PST 2016


parent_url() always prefixes with a '/' so it can never be None.  So
check for that to unbreak the endless loop.

This unbreaks calendars with Iceowl for me.
---
 calypso/paths.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/calypso/paths.py b/calypso/paths.py
index bedc39d..429b901 100644
--- a/calypso/paths.py
+++ b/calypso/paths.py
@@ -120,7 +120,7 @@ def resource_from_path(path):
     child_path = None
     collection = path
 
-    while collection and not is_collection(collection):
+    while collection != '/' and not is_collection(collection):
         child = child_url(collection)
         if child_path:
             child_path = child + "/" + child_path
@@ -146,7 +146,7 @@ def collection_from_path(path):
     """Returns Calypso collection name from ``path``."""
 
     collection = path
-    while collection and not is_collection(collection):
+    while collection != '/' and not is_collection(collection):
         collection = parent_url(collection)
 
     if not collection:
-- 
2.7.0.rc3


More information about the Calypso mailing list