[CalendarServer-changes] [15644] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue May 31 10:34:48 PDT 2016
Revision: 15644
http://trac.calendarserver.org//changeset/15644
Author: sagen at apple.com
Date: 2016-05-31 10:34:48 -0700 (Tue, 31 May 2016)
Log Message:
-----------
Handle concurrent delete/get of notification xml (by returning a 404 for the get)
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/storebridge.py
CalendarServer/trunk/txdav/common/datastore/sql_notification.py
Modified: CalendarServer/trunk/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/storebridge.py 2016-05-28 00:11:30 UTC (rev 15643)
+++ CalendarServer/trunk/twistedcaldav/storebridge.py 2016-05-31 17:34:48 UTC (rev 15644)
@@ -75,7 +75,7 @@
ObjectResourceNameAlreadyExistsError, UIDExistsError,
UIDExistsElsewhereError, InvalidUIDError, InvalidResourceMove,
InvalidComponentForStoreError, AlreadyInTrashError,
- HomeChildNameAlreadyExistsError
+ HomeChildNameAlreadyExistsError, ConcurrentModification
)
from txdav.idav import PropertyChangeNotAllowedError
from txdav.who.wiki import RecordType as WikiRecordType
@@ -4098,10 +4098,13 @@
log.debug("Resource not found: {s!r}", s=self)
raise HTTPError(NOT_FOUND)
- returnValue(
- Response(OK, {"content-type": self.contentType()},
- MemoryStream((yield self.text())))
- )
+ try:
+ returnValue(
+ Response(OK, {"content-type": self.contentType()},
+ MemoryStream((yield self.text())))
+ )
+ except ConcurrentModification:
+ raise HTTPError(NOT_FOUND)
@requiresPermissions(fromParent=[davxml.Unbind()])
Modified: CalendarServer/trunk/txdav/common/datastore/sql_notification.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_notification.py 2016-05-28 00:11:30 UTC (rev 15643)
+++ CalendarServer/trunk/txdav/common/datastore/sql_notification.py 2016-05-31 17:34:48 UTC (rev 15644)
@@ -29,7 +29,7 @@
from txdav.common.datastore.sql_tables import schema, _HOME_STATUS_NORMAL, \
_HOME_STATUS_EXTERNAL, _HOME_STATUS_DISABLED, _HOME_STATUS_MIGRATING
from txdav.common.datastore.sql_util import _SharedSyncLogic
-from txdav.common.icommondatastore import RecordNotAllowedError
+from txdav.common.icommondatastore import RecordNotAllowedError, ConcurrentModification
from txdav.common.idirectoryservice import DirectoryRecordNotFoundError
from txdav.common.inotifications import INotificationCollection, \
INotificationObject
@@ -859,7 +859,11 @@
@inlineCallbacks
def notificationData(self):
if self._notificationData is None:
- self._notificationData = (yield self._notificationDataFromID.on(self._txn, resourceID=self._resourceID))[0][0]
+ self._notificationData = (yield self._notificationDataFromID.on(self._txn, resourceID=self._resourceID))
+ if self._notificationData:
+ self._notificationData = self._notificationData[0][0]
+ else:
+ raise ConcurrentModification()
try:
self._notificationData = json.loads(self._notificationData)
except ValueError:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20160531/5d93fdf9/attachment.html>
More information about the calendarserver-changes
mailing list