[CalendarServer-changes] [8366] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Dec 2 09:31:59 PST 2011


Revision: 8366
          http://trac.macosforge.org/projects/calendarserver/changeset/8366
Author:   cdaboo at apple.com
Date:     2011-12-02 09:31:58 -0800 (Fri, 02 Dec 2011)
Log Message:
-----------
Make sure that PROPFIND Depth:1 on /.well-known works.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tap/util.py
    CalendarServer/trunk/twistedcaldav/simpleresource.py

Modified: CalendarServer/trunk/calendarserver/tap/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/util.py	2011-12-02 17:29:20 UTC (rev 8365)
+++ CalendarServer/trunk/calendarserver/tap/util.py	2011-12-02 17:31:58 UTC (rev 8366)
@@ -35,7 +35,6 @@
 from twext.web2.auth.basic import BasicCredentialFactory
 from twext.web2.dav import auth
 from twext.web2.http_headers import Headers
-from twext.web2.resource import RedirectResource
 from twext.web2.static import File as FileResource
 
 from twisted.cred.portal import Portal
@@ -61,7 +60,7 @@
 from twistedcaldav.directorybackedaddressbook import DirectoryBackedAddressBookResource
 from twistedcaldav.resource import CalDAVResource, AuthenticationWrapper
 from twistedcaldav.schedule import IScheduleInboxResource
-from twistedcaldav.simpleresource import SimpleResource
+from twistedcaldav.simpleresource import SimpleResource, SimpleRedirectResource
 from twistedcaldav.timezones import TimezoneCache
 from twistedcaldav.timezoneservice import TimezoneServiceResource
 from twistedcaldav.timezonestdservice import TimezoneStdServiceResource
@@ -526,7 +525,11 @@
                     port = config.HTTPPort
                 wellKnownResource.putChild(
                     wellknown_name,
-                    RedirectResource(scheme=scheme, port=port, path=redirected_to)
+                    SimpleRedirectResource(
+                        principalCollections=(principalCollection,),
+                        isdir=False,
+                        defaultACL=SimpleResource.allReadACL,
+                        scheme=scheme, port=port, path=redirected_to)
                 )
 
     for name, info in config.Aliases.iteritems():

Modified: CalendarServer/trunk/twistedcaldav/simpleresource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/simpleresource.py	2011-12-02 17:29:20 UTC (rev 8365)
+++ CalendarServer/trunk/twistedcaldav/simpleresource.py	2011-12-02 17:31:58 UTC (rev 8366)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2009-2010 Apple Inc. All rights reserved.
+# Copyright (c) 2009-2011 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.
@@ -22,8 +22,10 @@
 __all__ = [
     "SimpleResource",
     "SimpleCalDAVResource",
+    "SimpleRedirectResource",
 ]
 
+from twext.web2 import http
 from twext.web2.dav import davxml
 from twext.web2.dav.noneprops import NonePropertyStore
 
@@ -75,3 +77,21 @@
         return succeed(self.defaultACL)
 
 SimpleCalDAVResource = SimpleResource
+
+class SimpleRedirectResource(SimpleResource):
+    """
+    A L{SimpleResource} which always performs a redirect.
+    """
+
+    def __init__(self, principalCollections, isdir=False, defaultACL=SimpleResource.authReadACL, **kwargs):
+        """
+        Parameters are URL components and are the same as those for
+        L{urlparse.urlunparse}.  URL components which are not specified will
+        default to the corresponding component of the URL of the request being
+        redirected.
+        """
+        SimpleResource.__init__(self, principalCollections=principalCollections, isdir=isdir, defaultACL=defaultACL)
+        self._kwargs = kwargs
+
+    def renderHTTP(self, request):
+        return http.RedirectResponse(request.unparseURL(**self._kwargs))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20111202/843da0c7/attachment-0001.html>


More information about the calendarserver-changes mailing list