[CalendarServer-changes] [4402] CalendarServer/branches/users/sagen/pending-invites-4389/ twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Tue Jun 30 19:44:59 PDT 2009


Revision: 4402
          http://trac.macosforge.org/projects/calendarserver/changeset/4402
Author:   sagen at apple.com
Date:     2009-06-30 19:44:59 -0700 (Tue, 30 Jun 2009)
Log Message:
-----------
Remove old inbox item after publishing; tests now pass

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/pending-invites-4389/twistedcaldav/test/test_upgrade.py
    CalendarServer/branches/users/sagen/pending-invites-4389/twistedcaldav/upgrade.py

Modified: CalendarServer/branches/users/sagen/pending-invites-4389/twistedcaldav/test/test_upgrade.py
===================================================================
--- CalendarServer/branches/users/sagen/pending-invites-4389/twistedcaldav/test/test_upgrade.py	2009-06-30 22:51:53 UTC (rev 4401)
+++ CalendarServer/branches/users/sagen/pending-invites-4389/twistedcaldav/test/test_upgrade.py	2009-07-01 02:44:59 UTC (rev 4402)
@@ -162,7 +162,6 @@
         self.assertTrue(os.path.exists(os.path.join(config.DataRoot, CalendarUserProxyDatabase.dbFilename)))
 
 
-    @inlineCallbacks
     def test_freeBusyUpgrade(self):
         """
         Test the updating of calendar-free-busy-set xattrs on inboxes
@@ -817,7 +816,15 @@
         config.DocumentRoot = root
         config.DataRoot = root
 
-        self.assertRaises(UpgradeError, upgradeData, config)
+        try:
+            yield upgradeData(config)
+        except UpgradeError:
+            pass
+        except:
+            self.fail("Didn't raise UpgradeError")
+        else:
+            self.fail("Didn't raise UpgradeError -- or any exception")
+
         self.assertTrue(self.verifyHierarchy(root, after))
 
 
@@ -913,7 +920,7 @@
                                 {
                                     "*.ics" :
                                     {
-                                        "@contents" : None,
+                                        "@contents" : event03_implicit,
                                     },
                                     ".db.sqlite" :
                                     {
@@ -922,7 +929,7 @@
                                 },
                                 "inbox" :
                                 {
-                                    "b12d602b9f43b53fa4de27d3dea86fcd.ics" :
+                                    "*.ics" :
                                     {
                                         "@contents" : event03_inbox,
                                     },
@@ -936,10 +943,6 @@
                                     {
                                         "@contents" : None,
                                     },
-                                    "*.ics" :
-                                    {
-                                        "@contents" : None,
-                                    },
                                 },
                             },
                             "64230DAD-0BDE-4508-8C77-15F0CA5C8DD1" :
@@ -983,10 +986,8 @@
         config.DocumentRoot = root
         config.DataRoot = root
 
-        # import pdb; pdb.set_trace()
         yield upgradeData(config)
 
-        # import pdb; pdb.set_trace()
         self.assertTrue(self.verifyHierarchy(root, after))
 
 
@@ -1230,6 +1231,47 @@
 END:VCALENDAR
 """.replace("\n", "\r\n")
 
+event03_implicit = """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:STANDARD
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
+TZNAME:PST
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0800
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+TZNAME:PDT
+TZOFFSETFROM:-0800
+TZOFFSETTO:-0700
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:F18BA9DA-B1BA-4C94-9CB7-7E5BB7E30AE6
+DTSTART;TZID=US/Pacific:20090907T160000
+DTEND;TZID=US/Pacific:20090907T180000
+ATTENDEE;CN=Wilfredo Sanchez;CUTYPE=INDIVIDUAL;EMAIL=wsanchez at example.com;
+ PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;RSVP=TRUE:urn:uuid:6423F94A-6B7
+ 6-4A3A-815B-D52CFD77935D
+ATTENDEE;CN=Morgen Sagen;EMAIL=sagen at example.com;PARTSTAT=ACCEPTED:urn:uui
+ d:64230DAD-0BDE-4508-8C77-15F0CA5C8DD1
+CREATED:20090514T215838Z
+DTSTAMP:20090514T215856Z
+ORGANIZER;CN=Morgen Sagen;EMAIL=sagen at example.com:urn:uuid:64230DAD-0BDE-4
+ 508-8C77-15F0CA5C8DD1
+SEQUENCE:9
+SUMMARY:Pending Invitation
+TRANSP:TRANSPARENT
+X-APPLE-NEEDS-REPLY:TRUE
+END:VEVENT
+END:VCALENDAR
+""".replace("\n", "\r\n")
 
 def isValidCTag(value):
     """

Modified: CalendarServer/branches/users/sagen/pending-invites-4389/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/branches/users/sagen/pending-invites-4389/twistedcaldav/upgrade.py	2009-06-30 22:51:53 UTC (rev 4401)
+++ CalendarServer/branches/users/sagen/pending-invites-4389/twistedcaldav/upgrade.py	2009-07-01 02:44:59 UTC (rev 4402)
@@ -279,11 +279,16 @@
             originator = LocalCalendarUser(originator, originatorPrincipal)
 
             recipients = (owner,)
-            scheduler = DirectScheduler(FakeRequest(uidDir.parent, config.DocumentRoot),
+            scheduler = DirectScheduler(
+                FakeRequest(uidDir.parent, config.DocumentRoot),
                 icsFile)
             result = (yield scheduler.doSchedulingViaPUT(originator, recipients,
                 calendar, internal_request=False))
 
+            if os.path.exists(icsFile.fp.path):
+                os.remove(icsFile.fp.path)
+
+
         returnValue(None)
 
     def doProxyDatabaseMoveUpgrade(config, uid=-1, gid=-1):
@@ -480,14 +485,13 @@
                 log.warn("Done processing calendar homes")
 
 
-            # Process pending invitations
+            # Process pending invitations - unscheduled inbox items
+
             uidDir = CalendarHomeUIDProvisioningFile(uidHomes,
                 CalendarHomeProvisioningFile(calRoot, directory, "/calendars/"))
-
             for first in os.listdir(uidHomes):
                 if len(first) == 2:
                     firstPath = os.path.join(uidHomes, first)
-
                     for second in os.listdir(firstPath):
                         if len(second) == 2:
                             secondPath = os.path.join(firstPath, second)
@@ -504,8 +508,8 @@
                                 if inboxFile:
                                     # inboxPath = os.path.join(homePath, "inbox")
                                     # if os.path.exists(inboxPath):
-                                    yield processInbox(uidDir, homeFile, inboxFile, uuid,
-                                        directory)
+                                    yield processInbox(uidDir, homeFile,
+                                        inboxFile, uuid, directory)
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090630/e44b5b05/attachment.html>


More information about the calendarserver-changes mailing list