[CalendarServer-changes] [9140] CalendarServer/trunk/calendarserver/tools/shell/cmd.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Apr 16 16:49:26 PDT 2012


Revision: 9140
          http://trac.macosforge.org/projects/calendarserver/changeset/9140
Author:   wsanchez at apple.com
Date:     2012-04-16 16:49:26 -0700 (Mon, 16 Apr 2012)
Log Message:
-----------
Handle empty tokens list

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/shell/cmd.py

Modified: CalendarServer/trunk/calendarserver/tools/shell/cmd.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/cmd.py	2012-04-16 23:43:47 UTC (rev 9139)
+++ CalendarServer/trunk/calendarserver/tools/shell/cmd.py	2012-04-16 23:49:26 UTC (rev 9140)
@@ -151,16 +151,21 @@
         if filter is None:
             filter = lambda item: True
 
-        token = tokens[-1]
+        if tokens:
+            token = tokens[-1]
 
-        i = token.rfind("/")
-        if i == -1:
-            # No "/" in token
+            i = token.rfind("/")
+            if i == -1:
+                # No "/" in token
+                base = self.wd
+                word = token
+            else:
+                base = (yield self.wd.locate(token[:i].split("/")))
+                word = token[i+1:]
+
+        else:
             base = self.wd
-            word = token
-        else:
-            base = (yield self.wd.locate(token[:i].split("/")))
-            word = token[i+1:]
+            word = ""
 
         files = (
             entry.toString()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120416/68e2aeab/attachment.html>


More information about the calendarserver-changes mailing list