[CalendarServer-changes] [3371] CalendarServer/branches/users/wsanchez/deployment

source_changes at macosforge.org source_changes at macosforge.org
Tue Nov 11 19:32:16 PST 2008


Revision: 3371
          http://trac.macosforge.org/projects/calendarserver/changeset/3371
Author:   cdaboo at apple.com
Date:     2008-11-11 19:32:16 -0800 (Tue, 11 Nov 2008)
Log Message:
-----------
Merged r3189 from trunk.

Modified Paths:
--------------
    CalendarServer/branches/users/wsanchez/deployment/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch
    CalendarServer/branches/users/wsanchez/deployment/lib-patches/Twisted/twisted.web2.dav.resource.patch
    CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/method/put_common.py

Modified: CalendarServer/branches/users/wsanchez/deployment/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch
===================================================================
--- CalendarServer/branches/users/wsanchez/deployment/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch	2008-11-11 22:37:11 UTC (rev 3370)
+++ CalendarServer/branches/users/wsanchez/deployment/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch	2008-11-12 03:32:16 UTC (rev 3371)
@@ -2,7 +2,7 @@
 ===================================================================
 --- twisted/web2/dav/method/put_common.py	(revision 0)
 +++ twisted/web2/dav/method/put_common.py	(revision 0)
-@@ -0,0 +1,266 @@
+@@ -0,0 +1,267 @@
 +##
 +# Copyright (c) 2005-2007 Apple Inc. All rights reserved.
 +#
@@ -40,6 +40,7 @@
 +from twisted.web2.dav.resource import TwistedGETContentMD5
 +from twisted.web2.dav.stream import MD5StreamWrapper
 +from twisted.web2.http import HTTPError
++from twisted.web2.http_headers import generateContentType
 +from twisted.web2.iweb import IResponse
 +from twisted.web2.stream import MemoryStream
 +
@@ -227,7 +228,7 @@
 +        if source is None:
 +            content_type = request.headers.getHeader("content-type")
 +            if content_type is not None:
-+                destination.writeDeadProperty(davxml.GETContentType.fromString("%s/%s" % (content_type.mediaType, content_type.mediaSubtype,)))
++                destination.writeDeadProperty(davxml.GETContentType.fromString(generateContentType(content_type)))
 +
 +        response = IResponse(response)
 +        

Modified: CalendarServer/branches/users/wsanchez/deployment/lib-patches/Twisted/twisted.web2.dav.resource.patch
===================================================================
--- CalendarServer/branches/users/wsanchez/deployment/lib-patches/Twisted/twisted.web2.dav.resource.patch	2008-11-11 22:37:11 UTC (rev 3370)
+++ CalendarServer/branches/users/wsanchez/deployment/lib-patches/Twisted/twisted.web2.dav.resource.patch	2008-11-12 03:32:16 UTC (rev 3371)
@@ -64,7 +64,15 @@
          return succeed(qname in self.liveProperties or self.deadProperties().contains(qname))
  
      def readProperty(self, property, request):
-@@ -239,8 +257,10 @@
+@@ -201,7 +219,6 @@
+                     mimeType = self.contentType()
+                     if mimeType is None:
+                         return None
+-                    mimeType.params = None # WebDAV getcontenttype property does not include parameters
+                     return davxml.GETContentType(generateContentType(mimeType))
+ 
+                 if name == "getcontentlength":
+@@ -239,8 +256,10 @@
                      )
  
                  if name == "supported-report-set":
@@ -77,7 +85,7 @@
  
                  if name == "supported-privilege-set":
                      return self.supportedPrivileges(request)
-@@ -252,9 +272,10 @@
+@@ -252,9 +271,10 @@
                      return davxml.InheritedACLSet(*self.inheritedACLSet())
  
                  if name == "principal-collection-set":
@@ -91,7 +99,7 @@
  
                  def ifAllowed(privileges, callback):
                      def onError(failure):
-@@ -286,7 +307,36 @@
+@@ -286,7 +306,36 @@
                          d.addCallback(gotACL)
                          return d
                      return ifAllowed((davxml.ReadACL(),), callback)
@@ -128,7 +136,7 @@
              elif namespace == twisted_dav_namespace:
                  if name == "resource-class":
                      class ResourceClass (davxml.WebDAVTextElement):
-@@ -363,15 +413,28 @@
+@@ -363,15 +412,28 @@
          """
          See L{IDAVResource.listProperties}.
          """
@@ -161,7 +169,7 @@
      def listAllprop(self, request):
          """
          Some DAV properties should not be returned to a C{DAV:allprop} query.
-@@ -465,8 +528,22 @@
+@@ -465,8 +527,22 @@
              return super(DAVPropertyMixIn, self).displayName()
  
  class DAVResource (DAVPropertyMixIn, StaticRenderMixin):
@@ -184,7 +192,7 @@
      ##
      # DAV
      ##
-@@ -570,19 +647,21 @@
+@@ -570,19 +646,21 @@
          See L{IDAVResource.authorize}.
          """
          def onError(failure):
@@ -211,7 +219,7 @@
                      response = UnauthorizedResponse(request.credentialFactories,
                                                      request.remoteAddr)
                  else:
-@@ -593,7 +672,7 @@
+@@ -593,7 +671,7 @@
                  # class is supposed to be a FORBIDDEN status code and
                  # "Authorization will not help" according to RFC2616
                  #
@@ -220,7 +228,7 @@
  
              d = self.checkPrivileges(request, privileges, recurse)
              d.addErrback(onErrors)
-@@ -606,16 +685,21 @@
+@@ -606,16 +684,21 @@
  
      def authenticate(self, request):
          def loginSuccess(result):
@@ -246,7 +254,7 @@
  
          authHeader = request.headers.getHeader('authorization')
  
-@@ -631,9 +715,10 @@
+@@ -631,9 +714,10 @@
  
                  # Try to match principals in each principal collection on the resource
                  def gotDetails(details):
@@ -260,7 +268,7 @@
  
                  def login(pcreds):
                      d = request.portal.login(pcreds, None, *request.loginInterfaces)
-@@ -641,13 +726,15 @@
+@@ -641,13 +725,15 @@
  
                      return d
  
@@ -280,7 +288,7 @@
  
      ##
      # ACL
-@@ -656,49 +743,23 @@
+@@ -656,49 +742,23 @@
      def currentPrincipal(self, request):
          """
          @param request: the request being processed.
@@ -339,7 +347,7 @@
          """
          @return: the L{davxml.ACL} element containing the default access control
              list for this resource.
-@@ -710,6 +771,17 @@
+@@ -710,6 +770,17 @@
          #
          return readonlyACL
  
@@ -357,7 +365,7 @@
      def setAccessControlList(self, acl):
          """
          See L{IDAVResource.setAccessControlList}.
-@@ -748,13 +820,16 @@
+@@ -748,13 +819,16 @@
          # 10. Verify that new acl is not in conflict with itself
          # 11. Update acl on the resource
  
@@ -375,7 +383,7 @@
  
          # Need to get list of supported privileges
          supported = []
-@@ -1038,9 +1113,9 @@
+@@ -1038,9 +1112,9 @@
  
              if myURL == "/":
                  # If we get to the root without any ACLs, then use the default.
@@ -387,7 +395,7 @@
  
          # Dynamically update privileges for those ace's that are inherited.
          if inheritance:
-@@ -1076,7 +1151,7 @@
+@@ -1076,7 +1150,7 @@
                                  # Adjust ACE for inherit on this resource
                                  children = list(ace.children)
                                  children.remove(TwistedACLInheritable())
@@ -396,7 +404,7 @@
                                  aces.append(davxml.ACE(*children))
              else:
                  aces.extend(inherited_aces)
-@@ -1105,8 +1180,7 @@
+@@ -1105,8 +1179,7 @@
          the child resource loop and supply those to the checkPrivileges on each child.
  
          @param request: the L{IRequest} for the request in progress.
@@ -406,7 +414,7 @@
          """
          
          # Get the parent ACLs with inheritance and preserve the <inheritable> element.
-@@ -1128,21 +1202,9 @@
+@@ -1128,21 +1201,9 @@
                  # Adjust ACE for inherit on this resource
                  children = list(ace.children)
                  children.remove(TwistedACLInheritable())
@@ -430,7 +438,7 @@
  
      inheritedACEsforChildren = deferredGenerator(inheritedACEsforChildren)
  
-@@ -1152,49 +1214,69 @@
+@@ -1152,49 +1213,69 @@
  
          This implementation returns an empty set.
          """
@@ -528,7 +536,7 @@
      def samePrincipal(self, principal1, principal2):
          """
          Check whether the two prinicpals are exactly the same in terms of
-@@ -1219,7 +1301,6 @@
+@@ -1219,7 +1300,6 @@
              return False
                  
      def matchPrincipal(self, principal1, principal2, request):
@@ -536,7 +544,7 @@
          """
          Check whether the principal1 is a principal in the set defined by
          principal2.
-@@ -1244,6 +1325,9 @@
+@@ -1244,6 +1324,9 @@
              if isinstance(principal1, davxml.Unauthenticated):
                  yield False
                  return
@@ -546,7 +554,7 @@
              else:
                  yield True
                  return
-@@ -1271,7 +1355,6 @@
+@@ -1271,7 +1354,6 @@
  
          assert principal2 is not None, "principal2 is None"
  
@@ -554,7 +562,7 @@
          # Compare two HRefs and do group membership test as well
          if principal1 == principal2:
              yield True
-@@ -1289,6 +1372,7 @@
+@@ -1289,6 +1371,7 @@
  
      matchPrincipal = deferredGenerator(matchPrincipal)
  
@@ -562,7 +570,7 @@
      def principalIsGroupMember(self, principal1, principal2, request):
          """
          Check whether one principal is a group member of another.
-@@ -1299,18 +1383,21 @@
+@@ -1299,18 +1382,21 @@
          @return: L{Deferred} with result C{True} if principal1 is a member of principal2, C{False} otherwise
          """
          
@@ -595,7 +603,7 @@
          
      def validPrincipal(self, ace_principal, request):
          """
-@@ -1351,11 +1438,16 @@
+@@ -1351,11 +1437,16 @@
          @return C{True} if C{href_principal} is valid, C{False} otherwise.
  
          This implementation tests for a href element that corresponds to
@@ -615,7 +623,7 @@
          return d
  
      def resolvePrincipal(self, principal, request):
-@@ -1432,7 +1524,7 @@
+@@ -1432,7 +1523,7 @@
                  log.err("DAV:self ACE is set on non-principal resource %r" % (self,))
                  yield None
                  return
@@ -624,7 +632,7 @@
  
          if isinstance(principal, davxml.HRef):
              yield principal
-@@ -1517,6 +1609,270 @@
+@@ -1517,6 +1608,270 @@
          return None
  
      ##
@@ -895,7 +903,7 @@
      # HTTP
      ##
  
-@@ -1525,15 +1881,11 @@
+@@ -1525,15 +1880,11 @@
          #litmus = request.headers.getRawHeaders("x-litmus")
          #if litmus: log.msg("*** Litmus test: %s ***" % (litmus,))
  
@@ -913,7 +921,7 @@
  
          def setHeaders(response):
              response = IResponse(response)
-@@ -1567,7 +1919,7 @@
+@@ -1567,7 +1918,7 @@
      def findChildren(self, depth, request, callback, privileges=None, inherited_aces=None):
          return succeed(None)
  
@@ -922,7 +930,7 @@
      """
      Resource representing a WebDAV principal.  (RFC 3744, section 2)
      """
-@@ -1577,7 +1929,7 @@
+@@ -1577,7 +1928,7 @@
      # WebDAV
      ##
  
@@ -931,7 +939,7 @@
          (dav_namespace, "alternate-URI-set"),
          (dav_namespace, "principal-URL"    ),
          (dav_namespace, "group-member-set" ),
-@@ -1585,14 +1937,11 @@
+@@ -1585,14 +1936,11 @@
      )
  
      def davComplianceClasses(self):
@@ -947,7 +955,7 @@
      def readProperty(self, property, request):
          def defer():
              if type(property) is tuple:
-@@ -1610,10 +1959,20 @@
+@@ -1610,10 +1958,20 @@
                      return davxml.PrincipalURL(davxml.HRef(self.principalURL()))
  
                  if name == "group-member-set":
@@ -970,7 +978,7 @@
  
                  if name == "resourcetype":
                      if self.isCollection():
-@@ -1655,7 +2014,7 @@
+@@ -1655,7 +2013,7 @@
          principals.  Subclasses should override this method to provide member
          URLs for this resource if appropriate.
          """
@@ -979,7 +987,7 @@
  
      def groupMemberships(self):
          """
-@@ -1666,6 +2025,7 @@
+@@ -1666,6 +2024,7 @@
          """
          unimplemented(self)
  
@@ -987,7 +995,7 @@
      def principalMatch(self, href):
          """
          Check whether the supplied principal matches this principal or is a
-@@ -1675,10 +2035,33 @@
+@@ -1675,10 +2034,33 @@
          """
          uri = str(href)
          if self.principalURL() == uri:
@@ -1023,7 +1031,7 @@
  class AccessDeniedError(Exception):
      def __init__(self, errors):
          """ 
-@@ -1718,6 +2101,37 @@
+@@ -1718,6 +2100,37 @@
  davxml.registerElement(TwistedACLInheritable)
  davxml.ACE.allowed_children[(twisted_dav_namespace, "inheritable")] = (0, 1)
  

Modified: CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/method/put_common.py
===================================================================
--- CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/method/put_common.py	2008-11-11 22:37:11 UTC (rev 3370)
+++ CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/method/put_common.py	2008-11-12 03:32:16 UTC (rev 3371)
@@ -38,6 +38,7 @@
 from twisted.web2.dav.util import joinURL, parentForURL
 from twisted.web2.http import HTTPError
 from twisted.web2.http import StatusResponse
+from twisted.web2.http_headers import generateContentType
 from twisted.web2.iweb import IResponse
 from twisted.web2.stream import MemoryStream
 
@@ -572,7 +573,11 @@
                 log.err("Cannot index calendar resource: %s" % (ex,))
                 raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "valid-calendar-data")))
 
-            destination.writeDeadProperty(davxml.GETContentType.fromString("text/calendar"))
+            content_type = request.headers.getHeader("content-type")
+            if content_type is not None:
+                destination.writeDeadProperty(davxml.GETContentType.fromString(generateContentType(content_type)))
+            else:
+                destination.writeDeadProperty(davxml.GETContentType.fromString("text/calendar"))
             return None
 
         def doRemoveDestinationIndex():
@@ -615,7 +620,6 @@
                     NumberOfRecurrencesWithinLimits(PCDATAElement(str(ex.max_allowed)))
                 ))
 
-            source.writeDeadProperty(davxml.GETContentType.fromString("text/calendar"))
             return None
 
         if deletesource:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081111/2fa5e2cd/attachment-0001.html>


More information about the calendarserver-changes mailing list