[CalendarServer-changes] [13261] CalendarServer/branches/release/CalendarServer-5.3-dev
source_changes at macosforge.org
source_changes at macosforge.org
Fri Apr 11 10:25:39 PDT 2014
Revision: 13261
http://trac.calendarserver.org//changeset/13261
Author: cdaboo at apple.com
Date: 2014-04-11 10:25:39 -0700 (Fri, 11 Apr 2014)
Log Message:
-----------
Add accounting logging for invalid instance errors. Also tweak recently added accounting to use base64 encoding of UIDs.
Modified Paths:
--------------
CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/ical.py
CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/stdconfig.py
CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/test/test_icalendar.py
CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/processing.py
Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/ical.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/ical.py 2014-04-11 01:09:44 UTC (rev 13260)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/ical.py 2014-04-11 17:25:39 UTC (rev 13261)
@@ -39,10 +39,12 @@
from twext.web2.stream import IStream
from twext.web2.dav.util import allDataFromStream
+from twistedcaldav.accounting import accountingEnabledForCategory, \
+ emitAccounting
from twistedcaldav.config import config
from twistedcaldav.dateops import timeRangesOverlap, normalizeForIndex, differenceDateTime, \
normalizeForExpand
-from twistedcaldav.instance import InstanceList
+from twistedcaldav.instance import InstanceList, InvalidOverriddenInstanceError
from txdav.caldav.datastore.scheduling.cuaddress import normalizeCUAddr
from twistedcaldav.timezones import hasTZ, TimezoneException
@@ -1393,7 +1395,16 @@
# Set of instances to return
instances = InstanceList(ignoreInvalidInstances=ignoreInvalidInstances, normalizeFunction=normalizeFunction)
- instances.expandTimeRanges(componentSet, limit, lowerLimit=lowerLimit)
+ try:
+ instances.expandTimeRanges(componentSet, limit, lowerLimit=lowerLimit)
+ except InvalidOverriddenInstanceError as e:
+ if accountingEnabledForCategory("Invalid Instance"):
+ emitAccounting(
+ "Invalid Instance",
+ self.resourceUID().encode("base64")[:-1],
+ "{}\n\n{}".format(str(e), str(self)),
+ )
+ raise
return instances
Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/stdconfig.py 2014-04-11 01:09:44 UTC (rev 13260)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/stdconfig.py 2014-04-11 17:25:39 UTC (rev 13261)
@@ -482,6 +482,7 @@
"Implicit Errors": False,
"AutoScheduling": False,
"iSchedule": False,
+ "Invalid Instance": False,
},
"AccountingPrincipals": [],
"AccountingLogRoot" : "accounting",
Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/test/test_icalendar.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/test/test_icalendar.py 2014-04-11 01:09:44 UTC (rev 13260)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/test/test_icalendar.py 2014-04-11 17:25:39 UTC (rev 13261)
@@ -4231,6 +4231,64 @@
""",
),
(
+ "3.4 - valid end of month",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VTIMEZONE
+TZID:America/Chicago
+BEGIN:DAYLIGHT
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
+TZNAME:CDT
+TZOFFSETFROM:-0600
+TZOFFSETTO:-0500
+END:DAYLIGHT
+BEGIN:STANDARD
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
+TZNAME:CST
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0600
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART;TZID=America/Chicago:20130830T100000
+DTEND;TZID=America/Chicago:20130830T110000
+CREATED:20130822T011010Z
+DTSTAMP:20131025T180410Z
+RRULE:FREQ=MONTHLY;INTERVAL=3
+SEQUENCE:8
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID;TZID=America/Chicago:20131130T100000
+DTSTART;TZID=America/Chicago:20131130T100000
+DTEND;TZID=America/Chicago:20131130T110000
+CREATED:20130822T011010Z
+DTSTAMP:20131025T180410Z
+SEQUENCE:8
+STATUS:CANCELLED
+SUMMARY:Test
+END:VEVENT
+END:VCALENDAR""",
+ PyCalendarDateTime(2014, 8, 30, 10, 0, 0, PyCalendarTimezone(tzid="America/Chicago")),
+ """BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID;TZID=America/Chicago:20140830T100000
+DTSTART;TZID=America/Chicago:20140830T100000
+DTEND;TZID=America/Chicago:20140830T110000
+CREATED:20130822T011010Z
+DTSTAMP:20131025T180410Z
+SEQUENCE:8
+SUMMARY:Test
+END:VEVENT
+""",
+ ),
+ (
"4.1 - invalid all-day simple",
"""BEGIN:VCALENDAR
VERSION:2.0
Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/processing.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/processing.py 2014-04-11 01:09:44 UTC (rev 13260)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/processing.py 2014-04-11 17:25:39 UTC (rev 13261)
@@ -551,7 +551,7 @@
"AutoScheduling",
self.recipient.principal,
json.dumps(accounting) + "\r\n",
- filename=self.uid + ".txt"
+ filename=self.uid.encode("base64")[:-1] + ".txt"
)
# Only store inbox item when reply is not sent or always for users
@@ -593,7 +593,7 @@
"AutoScheduling",
self.recipient.principal,
json.dumps(accounting) + "\r\n",
- filename=self.uid + ".txt"
+ filename=self.uid.encode("base64")[:-1] + ".txt"
)
# Only store inbox item when reply is not sent or always for users
@@ -682,7 +682,7 @@
"AutoScheduling",
self.recipient.principal,
json.dumps(accounting) + "\r\n",
- filename=self.uid + ".txt"
+ filename=self.uid.encode("base64")[:-1] + ".txt"
)
if delete_original:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140411/33746847/attachment-0001.html>
More information about the calendarserver-changes
mailing list