[CalendarServer-changes] [14635] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Mon Mar 30 12:10:24 PDT 2015
Revision: 14635
http://trac.calendarserver.org//changeset/14635
Author: sagen at apple.com
Date: 2015-03-30 12:10:24 -0700 (Mon, 30 Mar 2015)
Log Message:
-----------
Fix some logging
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/provision/root.py
CalendarServer/trunk/txdav/common/datastore/test/test_trash.py
Modified: CalendarServer/trunk/calendarserver/provision/root.py
===================================================================
--- CalendarServer/trunk/calendarserver/provision/root.py 2015-03-30 16:59:34 UTC (rev 14634)
+++ CalendarServer/trunk/calendarserver/provision/root.py 2015-03-30 19:10:24 UTC (rev 14635)
@@ -235,7 +235,6 @@
"Wiki sessionID cookie value: {token}", token=token
)
- record = None
try:
uid = yield uidForAuthToken(token)
if uid == "unauthenticated":
@@ -270,9 +269,9 @@
if principal:
log.debug(
- "Wiki-authenticated principal {record.uid} "
+ "Wiki-authenticated principal {uid} "
"being assigned to authnUser and authzUser",
- record=record
+ uid=uid
)
request.authzUser = request.authnUser = principal
Modified: CalendarServer/trunk/txdav/common/datastore/test/test_trash.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/test/test_trash.py 2015-03-30 16:59:34 UTC (rev 14634)
+++ CalendarServer/trunk/txdav/common/datastore/test/test_trash.py 2015-03-30 19:10:24 UTC (rev 14635)
@@ -1894,6 +1894,111 @@
@inlineCallbacks
+ def test_trashDuplicateUID(self):
+ """
+ Verify a duplicate uid is purged from the trash when a matching event
+ is added to a collection
+ """
+
+ from twistedcaldav.stdconfig import config
+ self.patch(config, "EnableTrashCollection", True)
+
+ data1 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:5CE3B280-DBC9-4E8E-B0B2-996754020E5F
+DTSTART;TZID=America/Los_Angeles:20141108T093000
+DTEND;TZID=America/Los_Angeles:20141108T103000
+CREATED:20141106T192546Z
+DTSTAMP:20141106T192546Z
+RRULE:FREQ=DAILY
+SEQUENCE:0
+SUMMARY:repeating event
+TRANSP:OPAQUE
+END:VEVENT
+BEGIN:VEVENT
+UID:5CE3B280-DBC9-4E8E-B0B2-996754020E5F
+RECURRENCE-ID;TZID=America/Los_Angeles:20141111T093000
+DTSTART;TZID=America/Los_Angeles:20141111T110000
+DTEND;TZID=America/Los_Angeles:20141111T120000
+CREATED:20141106T192546Z
+DTSTAMP:20141106T192546Z
+SEQUENCE:0
+SUMMARY:repeating event
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
+"""
+
+ txn = self.store.newTransaction()
+
+ home = yield txn.calendarHomeWithUID("user01", create=True)
+ collection = yield home.childWithName("calendar")
+ # trash = yield home.getTrash(create=True)
+
+ resource = yield collection.createObjectResourceWithName(
+ "test.ics",
+ Component.allFromString(data1)
+ )
+
+ newName = yield resource.toTrash()
+
+ yield txn.commit()
+ yield JobItem.waitEmpty(self.store.newTransaction, reactor, 60)
+
+ txn = self.store.newTransaction()
+
+ resource = yield collection.createObjectResourceWithName(
+ "test.ics",
+ Component.allFromString(data1)
+ )
+ yield txn.commit()
+ yield JobItem.waitEmpty(self.store.newTransaction, reactor, 60)
+
+ # # Verify it's in the trash
+ # resource = yield self._getResource(txn, "user01", trash.name(), newName)
+ # self.assertTrue((yield resource.isInTrash()))
+ # trashed = yield resource.whenTrashed()
+ # self.assertFalse(trashed is None)
+
+ # # No objects in collection
+ # resourceNames = yield self._getResourceNames(txn, "user01", "calendar")
+ # self.assertEqual(len(resourceNames), 0)
+
+ # # One object in trash
+ # resourceNames = yield self._getResourceNames(txn, "user01", trash.name())
+ # self.assertEqual(len(resourceNames), 1)
+
+ # # Put back from trash
+ # yield resource.fromTrash()
+
+ # yield txn.commit()
+ # yield JobItem.waitEmpty(self.store.newTransaction, reactor, 60)
+
+ # txn = self.store.newTransaction()
+
+ # # Not in trash
+ # resource = yield self._getResource(txn, "user01", trash.name(), "")
+ # self.assertTrue(resource is None)
+
+
+ # # One object in collection
+ # resourceNames = yield self._getResourceNames(txn, "user01", "calendar")
+ # self.assertEqual(len(resourceNames), 1)
+ # resource = yield self._getResource(txn, "user01", "calendar", newName)
+ # self.assertFalse((yield resource.isInTrash()))
+ # trashed = yield resource.whenTrashed()
+ # self.assertTrue(trashed is None)
+
+ # # No objects in trash
+ # resourceNames = yield self._getResourceNames(txn, "user01", trash.name())
+ # self.assertEqual(len(resourceNames), 0)
+
+ # yield txn.commit()
+
+
+ @inlineCallbacks
def test_tool_emptyTrashForPrincipal(self):
from twistedcaldav.stdconfig import config
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150330/5fc0dad6/attachment.html>
More information about the calendarserver-changes
mailing list