[CalendarServer-changes] [10070] CalendarServer/branches/users/glyph/one-home-list-api

source_changes at macosforge.org source_changes at macosforge.org
Fri Nov 16 14:49:14 PST 2012


Revision: 10070
          http://trac.calendarserver.org//changeset/10070
Author:   glyph at apple.com
Date:     2012-11-16 14:49:14 -0800 (Fri, 16 Nov 2012)
Log Message:
-----------
Use new home enumeration API in shell's VFS layer.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/one-home-list-api/calendarserver/tools/shell/vfs.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/one-home-list-api/

Modified: CalendarServer/branches/users/glyph/one-home-list-api/calendarserver/tools/shell/vfs.py
===================================================================
--- CalendarServer/branches/users/glyph/one-home-list-api/calendarserver/tools/shell/vfs.py	2012-11-16 22:49:13 UTC (rev 10069)
+++ CalendarServer/branches/users/glyph/one-home-list-api/calendarserver/tools/shell/vfs.py	2012-11-16 22:49:14 UTC (rev 10070)
@@ -1,3 +1,4 @@
+# -*- test-case-name: calendarserver.tools.shell.test.test_vfs -*-
 ##
 # Copyright (c) 2011-2012 Apple Inc. All rights reserved.
 #
@@ -272,9 +273,8 @@
         # FIXME: Merge in directory UIDs also?
         # FIXME: Add directory info (eg. name) to list entry
 
-        def addResult(uid):
-            if uid in results:
-                return
+        def addResult(ignoredTxn, home):
+            uid = home.uid()
 
             record = self.service.directory.recordWithUID(uid)
             if record:
@@ -287,16 +287,8 @@
                 info = {}
 
             results[uid] = ListEntry(self, PrincipalHomeFolder, uid, **info)
-
-        txn = self.service.store.newTransaction()
-        try:
-            for home in (yield txn.calendarHomes()):
-                addResult(home.uid())
-            for home in (yield txn.addressbookHomes()):
-                addResult(home.uid())
-        finally:
-            (yield txn.abort())
-
+        yield self.service.store.withEachCalendarHomeDo(addResult)
+        yield self.service.store.withEachAddressbookHomeDo(addResult)
         returnValue(results.itervalues())
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20121116/54484d73/attachment.html>


More information about the calendarserver-changes mailing list