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

source_changes at macosforge.org source_changes at macosforge.org
Wed Jun 29 14:12:00 PDT 2011


Revision: 7690
          http://trac.macosforge.org/projects/calendarserver/changeset/7690
Author:   wsanchez at apple.com
Date:     2011-06-29 14:11:59 -0700 (Wed, 29 Jun 2011)
Log Message:
-----------
Fix .. logic in subdir(). Minor optimization of locate(). Crazy idea #7689.

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

Modified: CalendarServer/trunk/calendarserver/tools/shell.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell.py	2011-06-29 19:00:06 UTC (rev 7689)
+++ CalendarServer/trunk/calendarserver/tools/shell.py	2011-06-29 21:11:59 UTC (rev 7690)
@@ -216,7 +216,12 @@
         for name in self.wd.list():
             print name
 
+    def cmd_python(self, tokens):
+        # Crazy idea #19568: switch to an interactive python prompt
+        # with self exposed in globals.
+        raise NotImplementedError()
 
+
 class Directory(object):
     """
     Location in virtual data hierarchy.
@@ -234,13 +239,17 @@
         if not path:
             return RootDirectory(self.store)
 
+        name = path[0]
+        if not name:
+            return self.locate(path[1:])
+
         path = list(path)
 
-        if path[0].startswith("/"):
+        if name.startswith("/"):
             path[0] = path[0][1:]
             subdir = RootDirectory(self.store)
         else:
-            name = path.pop(0)
+            path.pop(0)
             subdir = self.subdir(name)
 
         if path:
@@ -254,7 +263,7 @@
         if name == ".":
             return self
         if name == "..":
-            return self.locate(self.path[:-1])
+            return RootDirectory(self.store).locate(self.path[:-1])
 
         raise NotFoundError("Directory %r has no subdirectory %r" % (str(self), name))
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110629/6f3a0978/attachment.html>


More information about the calendarserver-changes mailing list