[CalendarServer-changes] [2393] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu May 8 11:46:04 PDT 2008
Revision: 2393
http://trac.macosforge.org/projects/calendarserver/changeset/2393
Author: wsanchez at apple.com
Date: 2008-05-08 11:46:03 -0700 (Thu, 08 May 2008)
Log Message:
-----------
Remove drop box notifications feature, because I don't like it, so there.
Modified Paths:
--------------
CalendarServer/trunk/conf/caldavd-test.plist
CalendarServer/trunk/conf/caldavd.plist
CalendarServer/trunk/twistedcaldav/__init__.py
CalendarServer/trunk/twistedcaldav/admin/util.py
CalendarServer/trunk/twistedcaldav/config.py
CalendarServer/trunk/twistedcaldav/customxml.py
CalendarServer/trunk/twistedcaldav/directory/calendar.py
CalendarServer/trunk/twistedcaldav/directory/principal.py
CalendarServer/trunk/twistedcaldav/dropbox.py
CalendarServer/trunk/twistedcaldav/resource.py
CalendarServer/trunk/twistedcaldav/static.py
Removed Paths:
-------------
CalendarServer/trunk/twistedcaldav/notifications.py
Modified: CalendarServer/trunk/conf/caldavd-test.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test.plist 2008-05-08 17:00:24 UTC (rev 2392)
+++ CalendarServer/trunk/conf/caldavd-test.plist 2008-05-08 18:46:03 UTC (rev 2393)
@@ -340,10 +340,6 @@
<key>EnableDropBox</key>
<true/>
- <!-- Drop Box Notifications -->
- <key>EnableNotifications</key>
- <true/>
-
<!-- Private Events -->
<key>EnablePrivateEvents</key>
<true/>
Modified: CalendarServer/trunk/conf/caldavd.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd.plist 2008-05-08 17:00:24 UTC (rev 2392)
+++ CalendarServer/trunk/conf/caldavd.plist 2008-05-08 18:46:03 UTC (rev 2393)
@@ -261,10 +261,6 @@
<key>EnableDropBox</key>
<true/>
- <!-- Drop Box Notifications -->
- <key>EnableNotifications</key>
- <true/>
-
<!-- Private Events -->
<key>EnablePrivateEvents</key>
<true/>
Modified: CalendarServer/trunk/twistedcaldav/__init__.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/__init__.py 2008-05-08 17:00:24 UTC (rev 2392)
+++ CalendarServer/trunk/twistedcaldav/__init__.py 2008-05-08 18:46:03 UTC (rev 2393)
@@ -40,7 +40,6 @@
"instance",
"itip",
"log",
- "notifications",
"principalindex",
"resource",
"root",
Modified: CalendarServer/trunk/twistedcaldav/admin/util.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/admin/util.py 2008-05-08 17:00:24 UTC (rev 2392)
+++ CalendarServer/trunk/twistedcaldav/admin/util.py 2008-05-08 18:46:03 UTC (rev 2393)
@@ -18,7 +18,6 @@
import zlib
from zlib import decompress
from cPickle import loads as unpickle, UnpicklingError
-import os
import commands
Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py 2008-05-08 17:00:24 UTC (rev 2392)
+++ CalendarServer/trunk/twistedcaldav/config.py 2008-05-08 18:46:03 UTC (rev 2393)
@@ -155,7 +155,6 @@
# Non-standard CalDAV extensions
#
"EnableDropBox" : False, # Calendar Drop Box
- "EnableNotifications": False, # Drop Box Notifications
"EnablePrivateEvents": False, # Private Events
#
@@ -232,7 +231,6 @@
#
from twistedcaldav.resource import CalendarPrincipalResource
CalendarPrincipalResource.enableDropBox(self.EnableDropBox)
- CalendarPrincipalResource.enableNotifications(self.EnableNotifications)
self.updateLogLevels()
Modified: CalendarServer/trunk/twistedcaldav/customxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/customxml.py 2008-05-08 17:00:24 UTC (rev 2392)
+++ CalendarServer/trunk/twistedcaldav/customxml.py 2008-05-08 18:46:03 UTC (rev 2393)
@@ -124,14 +124,6 @@
namespace = calendarserver_namespace
name = "dropbox"
-class Notifications (davxml.WebDAVEmptyElement):
- """
- Denotes a notifications collection.
- (Apple Extension to CalDAV)
- """
- namespace = calendarserver_namespace
- name = "notifications"
-
class DropBoxHomeURL (davxml.WebDAVElement):
"""
A principal property to indicate the location of the drop box home.
@@ -144,81 +136,6 @@
allowed_children = { (davxml.dav_namespace, "href"): (0, 1) }
-class NotificationsURL (davxml.WebDAVElement):
- """
- A principal property to indicate the location of the notification collection.
- (Apple Extension to CalDAV)
- """
- namespace = calendarserver_namespace
- name = "notifications-URL"
- hidden = True
- protected = True
-
- allowed_children = { (davxml.dav_namespace, "href"): (0, 1) }
-
-class Notification(davxml.WebDAVElement):
- """
- Root element for XML data in a notification resource.
- """
- namespace = calendarserver_namespace
- name = "notification"
-
- allowed_children = {
- (calendarserver_namespace, "time-stamp" ): (1, 1),
- (calendarserver_namespace, "changed" ): (1, 1),
- }
-
-class TimeStamp (davxml.WebDAVTextElement):
- """
- A property to indicate the timestamp of a notification resource.
- (Apple Extension to CalDAV)
- """
- namespace = calendarserver_namespace
- name = "time-stamp"
- hidden = True
- protected = True
-
-class Changed (davxml.WebDAVElement):
- """
- A property to indicate the URI of the drop box that generated
- notification resource.
- (Apple Extension to CalDAV)
- """
- namespace = calendarserver_namespace
- name = "changed"
- hidden = True
- protected = True
-
- allowed_children = { (davxml.dav_namespace, "href"): (0, 1) }
-
-class Subscribed (davxml.WebDAVElement):
- """
- A property to indicate which principals will receive notifications.
- (Apple Extension to CalDAV)
- """
- namespace = calendarserver_namespace
- name = "subscribed"
- hidden = True
- protected = True
-
- allowed_children = { (davxml.dav_namespace, "principal"): (0, None) }
-
-class Subscribe (davxml.WebDAVEmptyElement):
- """
- Used in the body of a POST to subscribe to notifications.
- (Apple Extension to CalDAV)
- """
- namespace = calendarserver_namespace
- name = "subscribe"
-
-class Unsubscribe (davxml.WebDAVEmptyElement):
- """
- Used in the body of a POST to unsubscribe from notifications.
- (Apple Extension to CalDAV)
- """
- namespace = calendarserver_namespace
- name = "unsubscribe"
-
class GETCTag (davxml.WebDAVTextElement):
"""
Contains the calendar collection entity tag.
@@ -277,6 +194,5 @@
davxml.ResourceType.dropboxhome = davxml.ResourceType(davxml.Collection(), DropBoxHome())
davxml.ResourceType.dropbox = davxml.ResourceType(davxml.Collection(), DropBox())
-davxml.ResourceType.notifications = davxml.ResourceType(davxml.Collection(), Notifications())
davxml.ResourceType.calendarproxyread = davxml.ResourceType(davxml.Principal(), davxml.Collection(), CalendarProxyRead())
davxml.ResourceType.calendarproxywrite = davxml.ResourceType(davxml.Principal(), davxml.Collection(), CalendarProxyWrite())
Modified: CalendarServer/trunk/twistedcaldav/directory/calendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/calendar.py 2008-05-08 17:00:24 UTC (rev 2392)
+++ CalendarServer/trunk/twistedcaldav/directory/calendar.py 2008-05-08 18:46:03 UTC (rev 2393)
@@ -37,7 +37,6 @@
from twistedcaldav.config import config
from twistedcaldav.dropbox import DropBoxHomeResource
from twistedcaldav.extensions import ReadOnlyResourceMixIn, DAVResource
-from twistedcaldav.notifications import NotificationsCollectionResource
from twistedcaldav.resource import CalDAVResource
from twistedcaldav.schedule import ScheduleInboxResource, ScheduleOutboxResource
from twistedcaldav.directory.idirectory import IDirectoryService
@@ -262,10 +261,6 @@
childlist += (
("dropbox", DropBoxHomeResource),
)
- if config.EnableNotifications:
- childlist += (
- ("notifications", NotificationsCollectionResource),
- )
for name, cls in childlist:
child = self.provisionChild(name)
assert isinstance(child, cls), "Child %r is not a %s: %r" % (name, cls.__name__, child)
Modified: CalendarServer/trunk/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/principal.py 2008-05-08 17:00:24 UTC (rev 2392)
+++ CalendarServer/trunk/twistedcaldav/directory/principal.py 2008-05-08 18:46:03 UTC (rev 2393)
@@ -625,12 +625,6 @@
else:
return None
- def notificationsURL(self):
- if config.EnableNotifications:
- return self._homeChildURL("notifications/")
- else:
- return None
-
def _homeChildURL(self, name):
home = self._calendarHome()
if home is None:
Modified: CalendarServer/trunk/twistedcaldav/dropbox.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/dropbox.py 2008-05-08 17:00:24 UTC (rev 2392)
+++ CalendarServer/trunk/twistedcaldav/dropbox.py 2008-05-08 18:46:03 UTC (rev 2393)
@@ -15,8 +15,7 @@
##
"""
-Implements drop-box functionality. A drop box is an external attachment store that provides
-for automatic notification of changes to subscribed users.
+Implements drop-box functionality. A drop box is an external attachment store.
"""
__all__ = [
@@ -25,19 +24,11 @@
"DropBoxChildResource",
]
-import datetime
-import md5
-import time
-
-from twisted.internet.defer import deferredGenerator, waitForDeferred
from twisted.web2 import responsecode
from twisted.web2.dav import davxml
-from twisted.web2.dav.http import HTTPError, ErrorResponse, StatusResponse
-from twisted.web2.dav.resource import DAVResource, DAVPrincipalResource, TwistedACLInheritable
-from twisted.web2.dav.util import davXMLFromStream, parentForURL
+from twisted.web2.dav.http import ErrorResponse
+from twisted.web2.dav.resource import DAVResource, TwistedACLInheritable
-from twistedcaldav import customxml
-from twistedcaldav.config import config
from twistedcaldav.customxml import calendarserver_namespace
from twistedcaldav.log import Logger
@@ -86,275 +77,15 @@
# Do inherited with possibly modified set of aces
super(DropBoxCollectionResource, self).writeNewACEs(edited_aces)
- def doNotification(self, request, myURI):
- """
-
- @param childURI: URI of the child that changed and triggered the notification.
- """
- # First determine which principals should get notified
- #
- # Procedure:
- #
- # 1. Get the list of auto-subscribed principals from the parent collection property.
- # 2. Expand any group principals in the list into their user principals.
- # 3. Get the list of unsubscribed principals from the parent collection property.
- # 4. Expand any group principals in the list into their user principals.
- # 5. Generate a set from the difference between the subscribed list and unsubscribed list.
-
- def _expandPrincipals(principals):
- result = []
- for principal in principals:
-
- principal = waitForDeferred(self.resolvePrincipal(principal.children[0], request))
- yield principal
- principal = principal.getResult()
- if principal is None:
- continue
-
- presource = waitForDeferred(request.locateResource(str(principal)))
- yield presource
- presource = presource.getResult()
-
- if not isinstance(presource, DAVPrincipalResource):
- continue
-
- # Step 2. Expand groups.
- members = presource.groupMembers()
-
- if members:
- for member in members:
- result.append(davxml.Principal(davxml.HRef.fromString(member.principalURL())))
- else:
- result.append(davxml.Principal(principal))
- yield result
-
- _expandPrincipals = deferredGenerator(_expandPrincipals)
-
- # For drop box we look at the parent collection of the target resource and get the
- # set of subscribed principals.
- if not config.EnableNotifications or not self.hasDeadProperty(customxml.Subscribed):
- yield None
- return
-
- principals = set()
- autosubs = self.readDeadProperty(customxml.Subscribed).children
- d = waitForDeferred(_expandPrincipals(autosubs))
- yield d
- autosubs = d.getResult()
- principals.update(autosubs)
-
- my_principal = self.currentPrincipal(request)
-
- for principal in principals:
-
- # Don't send a notification to the principal that generated it
- if principal == my_principal:
- continue
-
- if not isinstance(principal.children[0], davxml.HRef):
- continue
- purl = str(principal.children[0])
- d = waitForDeferred(request.locateResource(purl))
- yield d
- presource = d.getResult()
-
- collectionURL = presource.notificationsURL()
- if collectionURL is None:
- continue
- d = waitForDeferred(request.locateResource(collectionURL))
- yield d
- collection = d.getResult()
-
- name = "%s.xml" % (md5.new(str(self) + str(time.time()) + collectionURL).hexdigest(),)
-
- # Create new resource in the collection
- d = waitForDeferred(request.locateChildResource(collection, name)) # This ensures the URI for the resource is mapped
- yield d
- child = d.getResult()
-
- d = waitForDeferred(child.create(request, datetime.datetime.utcnow(), myURI))
- yield d
- d.getResult()
-
- doNotification = deferredGenerator(doNotification)
-
- def http_DELETE(self, request):
- #
- # Handle notification of this drop box collection being deleted
- #
-
- def gotResponse(response):
- if response in (responsecode.OK, responsecode.NO_CONTENT):
- d = self.doNotification(request, request.uri)
- d.addCallback(lambda _: response)
- return d
-
- d = super(DropBoxCollectionResource, self).http_DELETE(request)
- d.addCallback(gotResponse)
- return d
-
def http_PUT(self, request):
return ErrorResponse(
responsecode.FORBIDDEN,
(calendarserver_namespace, "valid-drop-box")
)
- def http_MKCALENDAR (self, request):
- return ErrorResponse(
- responsecode.FORBIDDEN,
- (calendarserver_namespace, "valid-drop-box")
- )
-
- def http_POST(self, request):
- """
- Handle subscribe/unsubscribe requests only.
- """
-
- if not self.fp.exists():
- log.err("File not found: %s" % (self.fp.path,))
- raise HTTPError(responsecode.NOT_FOUND)
-
- # Read request body
- try:
- doc = waitForDeferred(davXMLFromStream(request.stream))
- yield doc
- doc = doc.getResult()
- except ValueError, e:
- error = "Must have valid XML request body for POST on a dropbox: %s" % (e,)
- log.err(error)
- raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
-
- # Determine whether we are subscribing or unsubscribing and handle that
- if doc is not None:
- root = doc.root_element
- if isinstance(root, customxml.Subscribe):
- action = self.subscribe
- elif isinstance(root, customxml.Unsubscribe):
- action = self.unsubscribe
- else:
- error = "XML request body for POST on a dropbox must contain a single <subscribe> or <unsubscribe> element"
- log.err(error)
- raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
- else:
- # If we get here we got an invalid request
- error = "Must have valid XML request body for POST on a dropbox"
- log.err(error)
- raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
-
- d = waitForDeferred(action(request))
- yield d
- result = d.getResult()
- yield result
-
- http_POST = deferredGenerator(http_POST)
-
- def subscribe(self, request):
- d = waitForDeferred(self.authorize(request, (davxml.Read(),)))
- yield d
- d.getResult()
- authid = request.authnUser
-
- # Get current list of subscribed principals
- principals = []
- if self.hasDeadProperty(customxml.Subscribed):
- subs = self.readDeadProperty(customxml.Subscribed).children
- principals.extend(subs)
-
- # Error if attempt to subscribe more than once
- if authid in principals:
- log.err("Cannot x_apple_subscribe to resource %s as principal %s is already subscribed" % (request.uri, repr(authid),))
- raise HTTPError(ErrorResponse(
- responsecode.FORBIDDEN,
- (calendarserver_namespace, "principal-must-not-be-subscribed"))
- )
-
- principals.append(authid)
- self.writeDeadProperty(customxml.Subscribed(*principals))
-
- yield responsecode.OK
-
- subscribe = deferredGenerator(subscribe)
-
- def unsubscribe(self, request):
- # We do not check any privileges. If a principal is subscribed we always allow them to
- # unsubscribe provided they have at least authenticated.
- d = waitForDeferred(self.authorize(request, ()))
- yield d
- d.getResult()
- authid = request.authnUser
-
- # Get current list of subscribed principals
- principals = []
- if self.hasDeadProperty(customxml.Subscribed):
- subs = self.readDeadProperty(customxml.Subscribed).children
- principals.extend(subs)
-
- # Error if attempt to subscribe more than once
- if authid not in principals:
- log.err("Cannot x_apple_unsubscribe from resource %s as principal %s is not currently subscribed" % (request.uri, repr(authid),))
- raise HTTPError(ErrorResponse(
- responsecode.FORBIDDEN,
- (calendarserver_namespace, "principal-must-be-subscribed"))
- )
-
- principals.remove(authid)
- self.writeDeadProperty(customxml.Subscribed(*principals))
-
- yield responsecode.OK
-
- unsubscribe = deferredGenerator(unsubscribe)
-
class DropBoxChildResource (DAVResource):
def http_MKCOL(self, request):
return ErrorResponse(
responsecode.FORBIDDEN,
(calendarserver_namespace, "valid-drop-box-resource")
)
- def http_MKCALENDAR (self, request):
- return ErrorResponse(
- responsecode.FORBIDDEN,
- (calendarserver_namespace, "valid-drop-box-resource")
- )
-
- def http_PUT(self, request):
- #
- # Handle notificiations
- #
- parentURL=parentForURL(request.uri)
-
- def gotParent(parent):
- def gotResponse(response):
- if response.code in (responsecode.OK, responsecode.CREATED, responsecode.NO_CONTENT):
- d = parent.doNotification(request, parentURL)
- d.addCallback(lambda _: response)
- return d
-
- d = super(DropBoxChildResource, self).http_PUT(request)
- d.addCallback(gotResponse)
- return d
-
- d = request.locateResource(parentURL)
- d.addCallback(gotParent)
- return d
-
- def http_DELETE(self, request):
- #
- # Handle notificiations
- #
- parentURL=parentForURL(request.uri)
-
- def gotParent(parent):
- def gotResponse(response):
- if response in (responsecode.OK, responsecode.NO_CONTENT):
- d = parent.doNotification(request, parentURL)
- d.addCallback(lambda _: response)
- return d
-
- d = super(DropBoxChildResource, self).http_DELETE(request)
- d.addCallback(gotResponse)
- return d
-
- d = request.locateResource(parentURL)
- d.addCallback(gotParent)
- return d
-
Deleted: CalendarServer/trunk/twistedcaldav/notifications.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/notifications.py 2008-05-08 17:00:24 UTC (rev 2392)
+++ CalendarServer/trunk/twistedcaldav/notifications.py 2008-05-08 18:46:03 UTC (rev 2393)
@@ -1,72 +0,0 @@
-##
-# Copyright (c) 2006-2007 Apple Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##
-
-
-"""
-Implements collection change notification functionality. Any change to the contents of a collection will
-result in a notification resource deposited into subscriber's notifications collection.
-"""
-
-__all__ = [
- "NotificationCollectionResource",
- "NotificationResource",
-]
-
-from twisted.web2 import responsecode
-from twisted.web2.dav import davxml
-from twisted.web2.dav.http import ErrorResponse
-
-from twistedcaldav.customxml import calendarserver_namespace
-from twistedcaldav.extensions import DAVResource
-
-class NotificationsCollectionResource (DAVResource):
- def resourceType(self):
- return davxml.ResourceType.notifications
-
- def isCollection(self):
- return True
-
- def notify(self):
- # FIXME: Move doNotification() logic from above class to here
- pass
-
- def http_PUT(self, request):
- return ErrorResponse(
- responsecode.FORBIDDEN,
- (calendarserver_namespace, "notifications-collection-no-client-resources")
- )
-
- def http_MKCOL (self, request):
- return ErrorResponse(
- responsecode.FORBIDDEN,
- (calendarserver_namespace, "notifications-collection-no-client-resources")
- )
-
- def http_MKCALENDAR (self, request):
- return ErrorResponse(
- responsecode.FORBIDDEN,
- (calendarserver_namespace, "notifications-collection-no-client-resources")
- )
-
-class NotificationResource(DAVResource):
- """
- Resource that gets stored in a notification collection and which contains
- the notification details in its content as well as via properties.
- """
- liveProperties = DAVResource.liveProperties + (
- (calendarserver_namespace, "time-stamp"),
- (calendarserver_namespace, "changed" ),
- )
Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py 2008-05-08 17:00:24 UTC (rev 2392)
+++ CalendarServer/trunk/twistedcaldav/resource.py 2008-05-08 18:46:03 UTC (rev 2393)
@@ -582,14 +582,6 @@
elif not enable and qname in clz.liveProperties:
clz.liveProperties = tuple([p for p in clz.liveProperties if p != qname])
- @classmethod
- def enableNotifications(clz, enable):
- qname = (calendarserver_namespace, "notifications-URL" )
- if enable and qname not in clz.liveProperties:
- clz.liveProperties += (qname,)
- elif not enable and qname in clz.liveProperties:
- clz.liveProperties = tuple([p for p in clz.liveProperties if p != qname])
-
def isCollection(self):
return True
@@ -635,13 +627,6 @@
else:
return customxml.DropBoxHomeURL(davxml.HRef(url))
- if name == "notifications-URL" and config.EnableNotifications:
- url = self.notificationsURL()
- if url is None:
- return None
- else:
- return customxml.NotificationsURL(davxml.HRef(url))
-
return super(CalendarPrincipalResource, self).readProperty(property, request)
return maybeDeferred(defer)
@@ -724,16 +709,6 @@
else:
return None
- def notificationsURL(self):
- """
- @return: the notifications collection URL for this principal.
- """
- if self.hasDeadProperty((calendarserver_namespace, "notifications-URL")):
- inbox = self.readDeadProperty((caldav_namespace, "notifications-URL"))
- return str(inbox.children[0])
- else:
- return None
-
##
# Utilities
##
Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py 2008-05-08 17:00:24 UTC (rev 2392)
+++ CalendarServer/trunk/twistedcaldav/static.py 2008-05-08 18:46:03 UTC (rev 2393)
@@ -30,8 +30,6 @@
"DropBoxHomeFile",
"DropBoxCollectionFile",
"DropBoxChildFile",
- "NotificationsCollectionFile",
- "NotificationFile",
]
import datetime
@@ -46,7 +44,6 @@
from twisted.web2.dav.fileop import mkcollection, rmdir
from twisted.web2.dav.http import ErrorResponse
from twisted.web2.dav.idav import IDAVResource
-from twisted.web2.dav.method import put_common as put_common_base
from twisted.web2.dav.resource import AccessDeniedError
from twisted.web2.dav.resource import davPrivilegeSet
from twisted.web2.dav.util import parentForURL, bindMethods
@@ -59,7 +56,6 @@
from twistedcaldav.ical import Component as iComponent
from twistedcaldav.ical import Property as iProperty
from twistedcaldav.index import Index, IndexSchedule
-from twistedcaldav.notifications import NotificationsCollectionResource, NotificationResource
from twistedcaldav.resource import CalDAVResource, isCalendarCollectionResource, isPseudoCalendarCollectionResource
from twistedcaldav.schedule import ScheduleInboxResource, ScheduleOutboxResource
from twistedcaldav.dropbox import DropBoxHomeResource, DropBoxCollectionResource, DropBoxChildResource
@@ -538,16 +534,11 @@
DropBoxHomeFileClass = DropBoxHomeFile
else:
DropBoxHomeFileClass = None
- if config.EnableNotifications:
- NotificationsCollectionFileClass = NotificationsCollectionFile
- else:
- NotificationsCollectionFileClass = None
cls = {
"inbox" : ScheduleInboxFile,
"outbox" : ScheduleOutboxFile,
"dropbox" : DropBoxHomeFileClass,
- "notifications": NotificationsCollectionFileClass,
}.get(name, None)
if cls is not None:
@@ -674,11 +665,6 @@
def __repr__(self):
return "<%s (dropbox collection): %s>" % (self.__class__.__name__, self.fp.path)
- http_DELETE = DropBoxCollectionResource.http_DELETE
- http_PUT = DropBoxCollectionResource.http_PUT
- http_MKCALENDAR = DropBoxCollectionResource.http_MKCALENDAR
- http_POST = DropBoxCollectionResource.http_POST
-
class DropBoxChildFile (DropBoxChildResource, CalDAVFile):
def __init__(self, path, parent):
DropBoxChildResource.__init__(self)
@@ -692,54 +678,6 @@
else:
return responsecode.NOT_FOUND
- http_MKCOL = DropBoxChildResource.http_MKCOL
- http_MKCALENDAR = DropBoxChildResource.http_MKCALENDAR
- http_PUT = DropBoxChildResource.http_PUT
-
-class NotificationsCollectionFile (AutoProvisioningFileMixIn, NotificationsCollectionResource, CalDAVFile):
- def __init__(self, path, parent):
- NotificationsCollectionResource.__init__(self)
- CalDAVFile.__init__(self, path, principalCollections=parent.principalCollections())
- self._parent = parent
-
- def createSimilarFile(self, path):
- if path == self.fp.path:
- return self
- else:
- return NotificationFile(path, self)
-
- def __repr__(self):
- return "<%s (notifications collection): %s>" % (self.__class__.__name__, self.fp.path)
-
- http_PUT = NotificationsCollectionResource.http_PUT
- http_MKCOL = NotificationsCollectionResource.http_MKCOL
- http_MKCALENDAR = NotificationsCollectionResource.http_MKCALENDAR
-
-class NotificationFile (NotificationResource, DAVFile):
- def __init__(self, path, parent):
- super(NotificationFile, self).__init__(path, principalCollections=parent.principalCollections())
-
- def create(self, request, timestamp, parentURL):
- """
- Create the resource, fill out the body, and add properties.
- """
- # Create body XML
- elements = []
- elements.append(customxml.TimeStamp.fromString(timestamp))
- elements.append(customxml.Changed(davxml.HRef.fromString(parentURL)))
-
- xml = customxml.Notification(*elements)
-
- d = waitForDeferred(put_common_base.storeResource(request, data=xml.toxml(), destination=self, destination_uri=request.urlForResource(self)))
- yield d
- d.getResult()
-
- # Write properties
- for element in elements:
- self.writeDeadProperty(element)
-
- create = deferredGenerator(create)
-
##
# Utilities
##
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080508/5da88243/attachment-0001.html
More information about the calendarserver-changes
mailing list