[CalendarServer-changes] [7682] CalendarServer/trunk/calendarserver/tools/shell.py
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jun 27 16:46:34 PDT 2011
Revision: 7682
http://trac.macosforge.org/projects/calendarserver/changeset/7682
Author: wsanchez at apple.com
Date: 2011-06-27 16:46:33 -0700 (Mon, 27 Jun 2011)
Log Message:
-----------
More path handling
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/shell.py
Modified: CalendarServer/trunk/calendarserver/tools/shell.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell.py 2011-06-27 23:07:12 UTC (rev 7681)
+++ CalendarServer/trunk/calendarserver/tools/shell.py 2011-06-27 23:46:33 UTC (rev 7682)
@@ -121,7 +121,7 @@
return subdir
def subdir(self, name):
- raise NotImplementedError()
+ raise NotFoundError("%s/%s" % (self, name))
class RootDirectory(Directory):
@@ -132,6 +132,9 @@
Directory.__init__(self, ())
def subdir(self, name):
+ if not name:
+ return self
+
raise NotFoundError("%s/%s" % (self, name))
@@ -198,6 +201,8 @@
print "-> %s" % (line,)
lexer = shlex(line)
+ lexer.whitespace_split = True
+
tokens = []
while True:
token = lexer.get_token()
@@ -207,9 +212,15 @@
if tokens:
cmd = tokens.pop(0)
+ #print "Arguments: %r" % (tokens,)
+
m = getattr(self, "cmd_%s" % (cmd,), None)
if m:
- m(tokens)
+ try:
+ m(tokens)
+ finally:
+ sys.stderr.flush()
+ sys.stdout.flush()
else:
print "Unknown command: %s" % (cmd,)
@@ -227,7 +238,11 @@
return
path = posixpath.split(dirname)
- self.wd = self.wd.goto(path)
+ try:
+ self.wd = self.wd.goto(path)
+ except NotFoundError:
+ print "Not such directory: %s" % (dirname,)
+ raise
def main(argv=sys.argv, stderr=sys.stderr, reactor=None):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110627/c8dff23b/attachment.html>
More information about the calendarserver-changes
mailing list