[CalendarServer-changes] [8283] CalendarServer/trunk/calendarserver/tools/shell.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Nov 11 14:04:18 PST 2011
Revision: 8283
http://trac.macosforge.org/projects/calendarserver/changeset/8283
Author: wsanchez at apple.com
Date: 2011-11-11 14:04:16 -0800 (Fri, 11 Nov 2011)
Log Message:
-----------
Add Calendar directory
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/shell.py
Modified: CalendarServer/trunk/calendarserver/tools/shell.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell.py 2011-11-11 21:38:10 UTC (rev 8282)
+++ CalendarServer/trunk/calendarserver/tools/shell.py 2011-11-11 22:04:16 UTC (rev 8283)
@@ -420,19 +420,16 @@
"""
Directory containing all principals by UID.
"""
+ @inlineCallbacks
def subdir(self, name):
- txn = self.store.newTransaction()
+ txn = self.store.newTransaction()
+ home = (yield txn.calendarHomeWithUID(name))
- def gotHome(home):
- if not home:
- return fail(NotFoundError("No calendar home for UID %r" % (name,)))
+ if home:
+ returnValue(CalendarHomeDirectory(self.store, self.path + (name,), home))
+ else:
+ raise NotFoundError("No calendar home for UID %r" % (name,))
- return CalendarHomeDirectory(self.store, self.path + (name,), home)
-
- d = txn.calendarHomeWithUID(name)
- d.addCallback(gotHome)
- return d
-
def list(self):
raise NotImplementedError("UIDDirectory.list() isn't implemented.")
d = self.store.eachCalendarHome()
@@ -481,11 +478,29 @@
returnValue("\n".join(result))
@inlineCallbacks
+ def subdir(self, name):
+ calendar = (yield self.home.calendarWithName(name))
+ if calendar:
+ returnValue(Calendar(self.store, self.path + (name,), calendar))
+ else:
+ raise NotFoundError("No calendar named %r" % (name,))
+
+ @inlineCallbacks
def list(self):
calendars = (yield self.home.calendars())
returnValue((c.name() for c in calendars))
+class Calendar(Directory):
+ """
+ Calendar.
+ """
+ def __init__(self, store, path, calendar):
+ Directory.__init__(self, store, path)
+
+ self.calendar = calendar
+
+
def main(argv=sys.argv, stderr=sys.stderr, reactor=None):
"""
Do the export.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20111111/c3b7601d/attachment.html>
More information about the calendarserver-changes
mailing list