[CalendarServer-changes] [11055] CalendarServer/branches/users/glyph/sharedgroups-2

source_changes at macosforge.org source_changes at macosforge.org
Tue Apr 16 15:23:56 PDT 2013


Revision: 11055
          http://trac.calendarserver.org//changeset/11055
Author:   glyph at apple.com
Date:     2013-04-16 15:23:56 -0700 (Tue, 16 Apr 2013)
Log Message:
-----------
Up to 11024.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tap/caldav.py
    CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tap/test/test_caldav.py
    CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tap/util.py
    CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tools/cmdline.py
    CalendarServer/branches/users/glyph/sharedgroups-2/conf/caldavd-test.plist
    CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/cache.py
    CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/directory/ldapdirectory.py
    CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/ical.py
    CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/method/propfind.py
    CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/stdconfig.py
    CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/storebridge.py
    CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/test/test_icalendar.py
    CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/util.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/sharedgroups-2/


Property changes on: CalendarServer/branches/users/glyph/sharedgroups-2
___________________________________________________________________
Modified: svn:mergeinfo
   - /CalendarServer/branches/config-separation:4379-4443
/CalendarServer/branches/egg-info-351:4589-4625
/CalendarServer/branches/generic-sqlstore:6167-6191
/CalendarServer/branches/new-store:5594-5934
/CalendarServer/branches/new-store-no-caldavfile:5911-5935
/CalendarServer/branches/new-store-no-caldavfile-2:5936-5981
/CalendarServer/branches/release/CalendarServer-4.3-dev:10180-10190,10192
/CalendarServer/branches/users/cdaboo/batchupload-6699:6700-7198
/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692:5693-5702
/CalendarServer/branches/users/cdaboo/component-set-fixes:8130-8346
/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
/CalendarServer/branches/users/cdaboo/implicituidrace:8137-8141
/CalendarServer/branches/users/cdaboo/ischedule-dkim:9747-9979
/CalendarServer/branches/users/cdaboo/managed-attachments:9985-10145
/CalendarServer/branches/users/cdaboo/more-sharing-5591:5592-5601
/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
/CalendarServer/branches/users/cdaboo/pods:7297-7377
/CalendarServer/branches/users/cdaboo/pycalendar:7085-7206
/CalendarServer/branches/users/cdaboo/pycard:7227-7237
/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes:7740-8287
/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
/CalendarServer/branches/users/cdaboo/shared-calendars-5187:5188-5440
/CalendarServer/branches/users/cdaboo/timezones:7443-7699
/CalendarServer/branches/users/cdaboo/txn-debugging:8730-8743
/CalendarServer/branches/users/glyph/always-abort-txn-on-error:9958-9969
/CalendarServer/branches/users/glyph/case-insensitive-uid:8772-8805
/CalendarServer/branches/users/glyph/conn-limit:6574-6577
/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
/CalendarServer/branches/users/glyph/dalify:6932-7023
/CalendarServer/branches/users/glyph/db-reconnect:6824-6876
/CalendarServer/branches/users/glyph/deploybuild:7563-7572
/CalendarServer/branches/users/glyph/digest-auth-redux:10624-10635
/CalendarServer/branches/users/glyph/disable-quota:7718-7727
/CalendarServer/branches/users/glyph/dont-start-postgres:6592-6614
/CalendarServer/branches/users/glyph/imip-and-admin-html:7866-7984
/CalendarServer/branches/users/glyph/ipv6-client:9054-9105
/CalendarServer/branches/users/glyph/linux-tests:6893-6900
/CalendarServer/branches/users/glyph/migrate-merge:8690-8713
/CalendarServer/branches/users/glyph/misc-portability-fixes:7365-7374
/CalendarServer/branches/users/glyph/more-deferreds-6:6322-6368
/CalendarServer/branches/users/glyph/more-deferreds-7:6369-6445
/CalendarServer/branches/users/glyph/multiget-delete:8321-8330
/CalendarServer/branches/users/glyph/new-export:7444-7485
/CalendarServer/branches/users/glyph/one-home-list-api:10048-10073
/CalendarServer/branches/users/glyph/oracle:7106-7155
/CalendarServer/branches/users/glyph/oracle-nulls:7340-7351
/CalendarServer/branches/users/glyph/other-html:8062-8091
/CalendarServer/branches/users/glyph/parallel-sim:8240-8251
/CalendarServer/branches/users/glyph/parallel-upgrade:8376-8400
/CalendarServer/branches/users/glyph/parallel-upgrade_to_1:8571-8583
/CalendarServer/branches/users/glyph/q:9560-9688
/CalendarServer/branches/users/glyph/queue-locking-and-timing:10204-10289
/CalendarServer/branches/users/glyph/quota:7604-7637
/CalendarServer/branches/users/glyph/sendfdport:5388-5424
/CalendarServer/branches/users/glyph/shared-pool-fixes:8436-8443
/CalendarServer/branches/users/glyph/shared-pool-take2:8155-8174
/CalendarServer/branches/users/glyph/sharedpool:6490-6550
/CalendarServer/branches/users/glyph/sharing-api:9192-9205
/CalendarServer/branches/users/glyph/skip-lonely-vtimezones:8524-8535
/CalendarServer/branches/users/glyph/sql-store:5929-6073
/CalendarServer/branches/users/glyph/subtransactions:7248-7258
/CalendarServer/branches/users/glyph/table-alias:8651-8664
/CalendarServer/branches/users/glyph/uidexport:7673-7676
/CalendarServer/branches/users/glyph/unshare-when-access-revoked:10562-10595
/CalendarServer/branches/users/glyph/use-system-twisted:5084-5149
/CalendarServer/branches/users/glyph/uuid-normalize:9268-9296
/CalendarServer/branches/users/glyph/xattrs-from-files:7757-7769
/CalendarServer/branches/users/sagen/applepush:8126-8184
/CalendarServer/branches/users/sagen/inboxitems:7380-7381
/CalendarServer/branches/users/sagen/locations-resources:5032-5051
/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
/CalendarServer/branches/users/sagen/purge_old_events:6735-6746
/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
/CalendarServer/branches/users/sagen/resources-2:5084-5093
/CalendarServer/branches/users/sagen/testing:10827-10851,10853-10855
/CalendarServer/branches/users/wsanchez/transations:5515-5593
/CalendarServer/trunk:9885-11020
   + /CalendarServer/branches/config-separation:4379-4443
/CalendarServer/branches/egg-info-351:4589-4625
/CalendarServer/branches/generic-sqlstore:6167-6191
/CalendarServer/branches/new-store:5594-5934
/CalendarServer/branches/new-store-no-caldavfile:5911-5935
/CalendarServer/branches/new-store-no-caldavfile-2:5936-5981
/CalendarServer/branches/release/CalendarServer-4.3-dev:10180-10190,10192
/CalendarServer/branches/users/cdaboo/batchupload-6699:6700-7198
/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692:5693-5702
/CalendarServer/branches/users/cdaboo/component-set-fixes:8130-8346
/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
/CalendarServer/branches/users/cdaboo/implicituidrace:8137-8141
/CalendarServer/branches/users/cdaboo/ischedule-dkim:9747-9979
/CalendarServer/branches/users/cdaboo/managed-attachments:9985-10145
/CalendarServer/branches/users/cdaboo/more-sharing-5591:5592-5601
/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
/CalendarServer/branches/users/cdaboo/pods:7297-7377
/CalendarServer/branches/users/cdaboo/pycalendar:7085-7206
/CalendarServer/branches/users/cdaboo/pycard:7227-7237
/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes:7740-8287
/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
/CalendarServer/branches/users/cdaboo/shared-calendars-5187:5188-5440
/CalendarServer/branches/users/cdaboo/timezones:7443-7699
/CalendarServer/branches/users/cdaboo/txn-debugging:8730-8743
/CalendarServer/branches/users/glyph/always-abort-txn-on-error:9958-9969
/CalendarServer/branches/users/glyph/case-insensitive-uid:8772-8805
/CalendarServer/branches/users/glyph/conn-limit:6574-6577
/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
/CalendarServer/branches/users/glyph/dalify:6932-7023
/CalendarServer/branches/users/glyph/db-reconnect:6824-6876
/CalendarServer/branches/users/glyph/deploybuild:7563-7572
/CalendarServer/branches/users/glyph/digest-auth-redux:10624-10635
/CalendarServer/branches/users/glyph/disable-quota:7718-7727
/CalendarServer/branches/users/glyph/dont-start-postgres:6592-6614
/CalendarServer/branches/users/glyph/imip-and-admin-html:7866-7984
/CalendarServer/branches/users/glyph/ipv6-client:9054-9105
/CalendarServer/branches/users/glyph/linux-tests:6893-6900
/CalendarServer/branches/users/glyph/migrate-merge:8690-8713
/CalendarServer/branches/users/glyph/misc-portability-fixes:7365-7374
/CalendarServer/branches/users/glyph/more-deferreds-6:6322-6368
/CalendarServer/branches/users/glyph/more-deferreds-7:6369-6445
/CalendarServer/branches/users/glyph/multiget-delete:8321-8330
/CalendarServer/branches/users/glyph/new-export:7444-7485
/CalendarServer/branches/users/glyph/one-home-list-api:10048-10073
/CalendarServer/branches/users/glyph/oracle:7106-7155
/CalendarServer/branches/users/glyph/oracle-nulls:7340-7351
/CalendarServer/branches/users/glyph/other-html:8062-8091
/CalendarServer/branches/users/glyph/parallel-sim:8240-8251
/CalendarServer/branches/users/glyph/parallel-upgrade:8376-8400
/CalendarServer/branches/users/glyph/parallel-upgrade_to_1:8571-8583
/CalendarServer/branches/users/glyph/q:9560-9688
/CalendarServer/branches/users/glyph/queue-locking-and-timing:10204-10289
/CalendarServer/branches/users/glyph/quota:7604-7637
/CalendarServer/branches/users/glyph/sendfdport:5388-5424
/CalendarServer/branches/users/glyph/shared-pool-fixes:8436-8443
/CalendarServer/branches/users/glyph/shared-pool-take2:8155-8174
/CalendarServer/branches/users/glyph/sharedpool:6490-6550
/CalendarServer/branches/users/glyph/sharing-api:9192-9205
/CalendarServer/branches/users/glyph/skip-lonely-vtimezones:8524-8535
/CalendarServer/branches/users/glyph/sql-store:5929-6073
/CalendarServer/branches/users/glyph/subtransactions:7248-7258
/CalendarServer/branches/users/glyph/table-alias:8651-8664
/CalendarServer/branches/users/glyph/uidexport:7673-7676
/CalendarServer/branches/users/glyph/unshare-when-access-revoked:10562-10595
/CalendarServer/branches/users/glyph/use-system-twisted:5084-5149
/CalendarServer/branches/users/glyph/uuid-normalize:9268-9296
/CalendarServer/branches/users/glyph/xattrs-from-files:7757-7769
/CalendarServer/branches/users/sagen/applepush:8126-8184
/CalendarServer/branches/users/sagen/inboxitems:7380-7381
/CalendarServer/branches/users/sagen/locations-resources:5032-5051
/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
/CalendarServer/branches/users/sagen/purge_old_events:6735-6746
/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
/CalendarServer/branches/users/sagen/resources-2:5084-5093
/CalendarServer/branches/users/sagen/testing:10827-10851,10853-10855
/CalendarServer/branches/users/wsanchez/transations:5515-5593
/CalendarServer/trunk:9885-11024

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tap/caldav.py	2013-04-16 22:22:28 UTC (rev 11054)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tap/caldav.py	2013-04-16 22:23:56 UTC (rev 11055)
@@ -78,7 +78,7 @@
 from twistedcaldav.upgrade import UpgradeFileSystemFormatService, PostDBImportService
 
 from calendarserver.tap.util import pgServiceFromConfig, getDBPool, MemoryLimitService
-from calendarserver.tap.util import directoryFromConfig
+from calendarserver.tap.util import directoryFromConfig, checkDirectories
 
 from twext.enterprise.ienterprise import POSTGRES_DIALECT
 from twext.enterprise.ienterprise import ORACLE_DIALECT
@@ -108,7 +108,6 @@
 from calendarserver.tap.util import pgConnectorFromConfig
 from calendarserver.tap.util import oracleConnectorFromConfig
 from calendarserver.tap.cfgchild import ConfiguredChildSpawner
-from calendarserver.tools.util import checkDirectory
 from calendarserver.push.notifier import PushDistributor
 from calendarserver.push.amppush import AMPPushMaster, AMPPushForwarder
 from calendarserver.push.applepush import ApplePushNotifierService
@@ -387,8 +386,8 @@
         config.updateDefaults(self.overrides)
 
 
-    def checkDirectory(self, dirpath, description, access=None, create=None, wait=False):
-        checkDirectory(dirpath, description, access=access, create=create, wait=wait)
+    def checkDirectories(self, config):
+        checkDirectories(config)
 
 
     def checkConfiguration(self):
@@ -418,59 +417,9 @@
 
         self.parent["pidfile"] = config.PIDFile
 
-        #
-        # Verify that server root actually exists
-        #
-        self.checkDirectory(
-            config.ServerRoot,
-            "Server root",
-            # Require write access because one might not allow editing on /
-            access=os.W_OK,
-            wait=True # Wait in a loop until ServerRoot exists
-        )
+        self.checkDirectories(config)
 
-        #
-        # Verify that other root paths are OK
-        #
-        if config.DataRoot.startswith(config.ServerRoot + os.sep):
-            self.checkDirectory(
-                config.DataRoot,
-                "Data root",
-                access=os.W_OK,
-                create=(0750, config.UserName, config.GroupName),
-            )
-        if config.DocumentRoot.startswith(config.DataRoot + os.sep):
-            self.checkDirectory(
-                config.DocumentRoot,
-                "Document root",
-                # Don't require write access because one might not allow editing on /
-                access=os.R_OK,
-                create=(0750, config.UserName, config.GroupName),
-            )
-        if config.ConfigRoot.startswith(config.ServerRoot + os.sep):
-            self.checkDirectory(
-                config.ConfigRoot,
-                "Config root",
-                access=os.W_OK,
-                create=(0750, config.UserName, config.GroupName),
-            )
 
-        if config.LogRoot.startswith(config.ServerRoot + os.sep):
-            self.checkDirectory(
-                config.LogRoot,
-                "Log root",
-                access=os.W_OK,
-                create=(0750, config.UserName, config.GroupName),
-            )
-
-        # Always create RunRoot (for pid files, socket files) if it does not exist
-        self.checkDirectory(
-            config.RunRoot,
-            "Run root",
-            access=os.W_OK,
-            create=(0770, config.UserName, config.GroupName),
-        )
-
         #
         # Nuke the file log observer's time format.
         #

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tap/test/test_caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tap/test/test_caldav.py	2013-04-16 22:22:28 UTC (rev 11054)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tap/test/test_caldav.py	2013-04-16 22:23:56 UTC (rev 11055)
@@ -152,6 +152,8 @@
     def checkFile(self, *args, **kwargs):
         pass
 
+    def checkDirectories(self, *args, **kwargs):
+        pass
 
     def loadConfiguration(self):
         """

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tap/util.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tap/util.py	2013-04-16 22:22:28 UTC (rev 11054)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tap/util.py	2013-04-16 22:23:56 UTC (rev 11055)
@@ -86,6 +86,7 @@
 
 from calendarserver.accesslog import DirectoryLogWrapperResource
 from calendarserver.provision.root import RootResource
+from calendarserver.tools.util import checkDirectory
 from calendarserver.webadmin.resource import WebAdminResource
 from calendarserver.webcal.resource import WebCalendarResource
 
@@ -960,3 +961,60 @@
                         self._processMonitor.stopProcess(name)
         finally:
             self._delayedCall = self._reactor.callLater(self._seconds, self.checkMemory)
+
+
+def checkDirectories(config):
+    """
+    Make sure that various key directories exist (and create if needed)
+    """
+    
+    #
+    # Verify that server root actually exists
+    #
+    checkDirectory(
+        config.ServerRoot,
+        "Server root",
+        # Require write access because one might not allow editing on /
+        access=os.W_OK,
+        wait=True # Wait in a loop until ServerRoot exists
+    )
+
+    #
+    # Verify that other root paths are OK
+    #
+    if config.DataRoot.startswith(config.ServerRoot + os.sep):
+        checkDirectory(
+            config.DataRoot,
+            "Data root",
+            access=os.W_OK,
+            create=(0750, config.UserName, config.GroupName),
+        )
+    if config.DocumentRoot.startswith(config.DataRoot + os.sep):
+        checkDirectory(
+            config.DocumentRoot,
+            "Document root",
+            # Don't require write access because one might not allow editing on /
+            access=os.R_OK,
+            create=(0750, config.UserName, config.GroupName),
+        )
+    if config.ConfigRoot.startswith(config.ServerRoot + os.sep):
+        checkDirectory(
+            config.ConfigRoot,
+            "Config root",
+            access=os.W_OK,
+            create=(0750, config.UserName, config.GroupName),
+        )
+    if config.LogRoot.startswith(config.ServerRoot + os.sep):
+        checkDirectory(
+            config.LogRoot,
+            "Log root",
+            access=os.W_OK,
+            create=(0750, config.UserName, config.GroupName),
+        )
+    if config.RunRoot.startswith(config.ServerRoot + os.sep):
+        checkDirectory(
+            config.RunRoot,
+            "Run root",
+            access=os.W_OK,
+            create=(0770, config.UserName, config.GroupName),
+        )

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tools/cmdline.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tools/cmdline.py	2013-04-16 22:22:28 UTC (rev 11054)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/calendarserver/tools/cmdline.py	2013-04-16 22:23:56 UTC (rev 11055)
@@ -19,6 +19,7 @@
 """
 
 from calendarserver.tap.caldav import CalDAVServiceMaker, CalDAVOptions
+from calendarserver.tap.util import checkDirectories
 from calendarserver.tools.util import loadConfig, autoDisableMemcached
 
 from twext.python.log import StandardIOObserver
@@ -26,7 +27,6 @@
 from twistedcaldav.config import ConfigurationError
 from twisted.internet.defer import inlineCallbacks
 
-import os
 import sys
 from calendarserver.tap.util import getRootResource
 from twisted.application.service import Service
@@ -79,10 +79,7 @@
         if patchConfig is not None:
             patchConfig(config)
 
-        # If we don't have permission to access the DataRoot directory, we
-        # can't proceed.  If this fails it should raise OSError which we
-        # catch below.
-        os.listdir(config.DataRoot)
+        checkDirectories(config)
 
         config.ProcessType = "Utility"
         config.UtilityServiceClass = serviceClass

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/conf/caldavd-test.plist
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/conf/caldavd-test.plist	2013-04-16 22:22:28 UTC (rev 11054)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/conf/caldavd-test.plist	2013-04-16 22:23:56 UTC (rev 11055)
@@ -772,8 +772,6 @@
         <false/>
         <key>AttendeeRefreshBatch</key>
         <integer>0</integer>
-        <key>V1Compatibility</key> <!-- Allow /path-based CUAs in scheduling replies -->
-        <false/>
 
 		<key>AutoSchedule</key>
 		<dict>

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/cache.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/cache.py	2013-04-16 22:22:28 UTC (rev 11054)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/cache.py	2013-04-16 22:23:56 UTC (rev 11055)
@@ -20,7 +20,7 @@
 
 from zope.interface import implements
 
-from twisted.internet.defer import succeed, maybeDeferred, inlineCallbacks,\
+from twisted.internet.defer import succeed, maybeDeferred, inlineCallbacks, \
     returnValue
 from twext.web2.dav.util import allDataFromStream
 from twext.web2.http import Response
@@ -50,15 +50,15 @@
   - directoryToken - a hash of that principal's directory record
   - uriToken - a token for the request uri
   - childTokens - tokens for any child resources the request uri depends on (for depth:1)
-  
+
   The current principalToken, uriToken and childTokens values are themselves stored in the cache using the key prefix 'cacheToken:'.
 When the 'changeCache' api is called the cached value for the matching token is updated.
-  
+
 (4) When a request is being checked in the cache, the response cache entry key is first computed and any value extracted. The
 tokens in the value are then checked against the current set of tokens in the cache. If there is any mismatch between tokens, the
 cache entry is considered invalid and the cached response is not returned. If everything matches up, the cached response is returned
 to the caller and ultimately sent directly back to the client.
- 
+
 (5) Because of shared calendars/address books that can affect the calendar/address book homes of several different users at once, we
 need to keep track of the separate childTokens for each child resource. The tokens for shared resources are keyed of the sharer's uri,
 so sharee's homes use that token. That way a single token for all shared instances is used and changed just once.
@@ -72,18 +72,22 @@
     def __init__(self, *args, **kwargs):
         pass
 
+
     def changed(self):
         return succeed(None)
 
 
+
 class DisabledCache(object):
     def getResponseForRequest(self, request):
         return succeed(None)
 
+
     def cacheResponseForRequest(self, request, response):
         return succeed(response)
 
 
+
 class URINotFoundException(Exception):
     def __init__(self, uri):
         self.uri = uri
@@ -95,6 +99,7 @@
             self.uri)
 
 
+
 class MemcacheChangeNotifier(LoggingMixIn, CachePoolUserMixIn):
 
     def __init__(self, resource, cachePool=None, cacheHandle="Default"):
@@ -102,22 +107,31 @@
         self._cachePool = cachePool
         self._cachePoolHandle = cacheHandle
 
+
     def _newCacheToken(self):
         return str(uuid.uuid4())
 
+
     def changed(self):
         """
         Change the cache token for a resource
 
         return: A L{Deferred} that fires when the token has been changed.
         """
-        url = self._resource.url()
 
+        # For shared resources we use the owner URL as the cache key
+        if hasattr(self._resource, "owner_url"):
+            url = self._resource.owner_url()
+        else:
+            url = self._resource.url()
+
         self.log_debug("Changing Cache Token for %r" % (url,))
         return self.getCachePool().set(
             'cacheToken:%s' % (url,),
-            self._newCacheToken(), expireTime=config.ResponseCacheTimeout*60)
-            
+            self._newCacheToken(), expireTime=config.ResponseCacheTimeout * 60)
+
+
+
 class BaseResponseCache(LoggingMixIn):
     """
     A base class which provides some common operations
@@ -149,10 +163,10 @@
     def _canonicalizeURIForRequest(self, uri, request):
         """
         Always use canonicalized forms of the URIs for caching (i.e. __uids__ paths).
-        
-        Do this without calling locateResource which may cause a query on the store. 
+
+        Do this without calling locateResource which may cause a query on the store.
         """
-        
+
         uribits = uri.split("/")
         if len(uribits) > 1 and uribits[1] in ("principals", "calendars", "addressbooks"):
             if uribits[2] == "__uids__":
@@ -166,8 +180,7 @@
                     uribits[2] = "__uids__"
                     uribits[3] = record.uid
                     return succeed("/".join(uribits))
-                
-            
+
         # Fall back to the locateResource approach
         try:
             return request.locateResource(uri).addCallback(
@@ -190,6 +203,7 @@
 
         return d
 
+
     @inlineCallbacks
     def _requestKey(self, request):
         """
@@ -201,7 +215,7 @@
             # Give it back to the request so it can be read again
             request.stream = MemoryStream(requestBody)
             request.stream.doStartReading = None
-            
+
             # Normalize the property order by doing a "dumb" sort on lines
             requestLines = requestBody.splitlines()
             requestLines.sort()
@@ -222,6 +236,7 @@
         return d1
 
 
+
 class MemcacheResponseCache(BaseResponseCache, CachePoolUserMixIn):
     def __init__(self, docroot, cachePool=None):
         self._docroot = docroot
@@ -238,6 +253,7 @@
         else:
             return self.getCachePool().get('cacheToken:%s' % (uri,))
 
+
     @inlineCallbacks
     def _tokenForRecord(self, uri, request):
         """
@@ -247,19 +263,21 @@
         record = (yield self._getRecordForURI(uri, request))
         returnValue(record.cacheToken())
 
+
     @inlineCallbacks
     def _tokensForChildren(self, rURI, request):
         """
         Create a dict of child resource tokens for any "recorded" during this request in the childCacheURIs attribute.
         """
-        
+
         if hasattr(request, "childCacheURIs"):
             tokens = dict([(uri, (yield self._tokenForURI(uri)),) for uri in request.childCacheURIs])
             returnValue(tokens)
         else:
             returnValue({})
-    
-    @inlineCallbacks 
+
+
+    @inlineCallbacks
     def _getTokens(self, request):
         """
         Tokens are a principal token, directory record token, resource token and list
@@ -296,19 +314,19 @@
         """
         try:
             key = (yield self._hashedRequestKey(request))
-    
+
             self.log_debug("Checking cache for: %r" % (key,))
             _ignore_flags, value = (yield self.getCachePool().get(key))
-    
+
             if value is None:
                 self.log_debug("Not in cache: %r" % (key,))
                 returnValue(None)
-    
+
             self.log_debug("Found in cache: %r = %r" % (key, value))
-    
+
             (principalToken, directoryToken, uriToken, childTokens, (code, headers, body)) = cPickle.loads(value)
             currentTokens = (yield self._getTokens(request))
-    
+
             if currentTokens[0] != principalToken:
                 self.log_debug(
                     "Principal token doesn't match for %r: %r != %r" % (
@@ -316,7 +334,7 @@
                         currentTokens[0],
                         principalToken))
                 returnValue(None)
-    
+
             if currentTokens[1] != directoryToken:
                 self.log_debug(
                     "Directory Record Token doesn't match for %r: %r != %r" % (
@@ -324,7 +342,7 @@
                         currentTokens[1],
                         directoryToken))
                 returnValue(None)
-    
+
             if currentTokens[2] != uriToken:
                 self.log_debug(
                     "URI token doesn't match for %r: %r != %r" % (
@@ -332,7 +350,7 @@
                         currentTokens[2],
                         uriToken))
                 returnValue(None)
-    
+
             for childuri, token in childTokens.items():
                 currentToken = (yield self._tokenForURI(childuri))
                 if currentToken != token:
@@ -343,19 +361,20 @@
                             currentToken,
                             token))
                     returnValue(None)
-                     
+
             r = Response(code,
                          stream=MemoryStream(body))
-    
+
             for key, value in headers.iteritems():
                 r.headers.setRawHeaders(key, value)
-    
+
             returnValue(r)
 
         except URINotFoundException, e:
             self.log_debug("Could not locate URI: %r" % (e,))
             returnValue(None)
 
+
     @inlineCallbacks
     def cacheResponseForRequest(self, request, response):
         """
@@ -368,9 +387,9 @@
                 key = request.cacheKey
             else:
                 key = (yield self._hashedRequestKey(request))
-    
+
             key, responseBody = (yield self._getResponseBody(key, response))
-    
+
             response.headers.removeHeader('date')
             response.stream = MemoryStream(responseBody)
             pToken, dToken, uToken, cTokens = (yield self._getTokens(request))
@@ -388,30 +407,34 @@
             ))
             self.log_debug("Adding to cache: %r = %r" % (key, cacheEntry))
             yield self.getCachePool().set(key, cacheEntry,
-                expireTime=config.ResponseCacheTimeout*60)
+                expireTime=config.ResponseCacheTimeout * 60)
 
         except URINotFoundException, e:
             self.log_debug("Could not locate URI: %r" % (e,))
 
-        returnValue(response)            
+        returnValue(response)
 
 
+
 class _CachedResponseResource(object):
     implements(IResource)
 
     def __init__(self, response):
         self._response = response
 
+
     def renderHTTP(self, request):
         if not hasattr(request, "extendedLogItems"):
             request.extendedLogItems = {}
         request.extendedLogItems["cached"] = "1"
         return self._response
 
+
     def locateChild(self, request, segments):
         return self, []
 
 
+
 class PropfindCacheMixin(object):
     """
     A mixin that causes a resource's PROPFIND response to be cached. It also adds an api to change the
@@ -433,12 +456,15 @@
             d.addCallback(_getResponseCache)
         return d
 
+
     def changeCache(self):
         if hasattr(self, 'cacheNotifier'):
             return self.cacheNotifier.changed()
         else:
             self.log_debug("%r does not have a cacheNotifier but was changed" % (self,))
 
+
+
 class ResponseCacheMixin(object):
     """
     This is a mixin for a child resource that does not itself cache PROPFINDs, but needs to invalidate a parent
@@ -451,19 +477,25 @@
         else:
             self.log_debug("%r does not have a cacheNotifier but was changed" % (self,))
 
+
+
 class CacheStoreNotifier(object):
-    
+
     def __init__(self, resource):
         self.resource = resource
-    
+
+
     def notify(self, op="update"):
         self.resource.changeCache()
 
+
     def clone(self, label="default", id=None):
         return self
 
+
     def getID(self, label="default"):
         return None
 
+
     def nodeName(self, label="default"):
         return succeed(None)

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/directory/ldapdirectory.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/directory/ldapdirectory.py	2013-04-16 22:22:28 UTC (rev 11054)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/directory/ldapdirectory.py	2013-04-16 22:23:56 UTC (rev 11055)
@@ -480,6 +480,11 @@
                 # Seen when using an empty password, treat as invalid creds
                 raise ldap.INVALID_CREDENTIALS()
 
+            except ldap.NO_SUCH_OBJECT:
+                self.log_error("LDAP Authentication error for %s: NO_SUCH_OBJECT"
+                    % (dn,))
+                # fall through to try again; could be transient
+
             except ldap.INVALID_CREDENTIALS:
                 raise
 

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/ical.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/ical.py	2013-04-16 22:22:28 UTC (rev 11054)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/ical.py	2013-04-16 22:23:56 UTC (rev 11055)
@@ -2994,26 +2994,13 @@
                 cutype = prop.parameterValue("CUTYPE")
 
                 if toUUID:
-                    # Store the original CUA if http(s) or /path:
-                    if config.Scheduling.Options.V1Compatibility:
-                        if cuaddr.startswith("http") or cuaddr.startswith("/"):
-                            prop.setParameter("CALENDARSERVER-OLD-CUA",
-                                "base64-%s" % (base64.b64encode(prop.value())))
-
                     # Always re-write value to urn:uuid
                     prop.setValue("urn:uuid:%s" % (guid,))
 
                 # If it is already a non-UUID address leave it be
                 elif cuaddr.startswith("urn:uuid:"):
 
-                    # Restore old CUA
-                    oldExternalCUA = prop.parameterValue("CALENDARSERVER-OLD-CUA")
-                    if oldExternalCUA:
-                        if oldExternalCUA.startswith("base64-"):
-                            oldExternalCUA = base64.b64decode(oldExternalCUA[7:])
-                        newaddr = oldExternalCUA
-                        prop.removeParameter("CALENDARSERVER-OLD-CUA")
-                    elif oldemail:
+                    if oldemail:
                         # Use the EMAIL parameter if it exists
                         newaddr = oldemail
                     else:

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/method/propfind.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/method/propfind.py	2013-04-16 22:22:28 UTC (rev 11054)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/method/propfind.py	2013-04-16 22:23:56 UTC (rev 11055)
@@ -219,8 +219,11 @@
 
             # This needed for propfind cache tracking of children changes
             if depth == "1":
-                if resource != self and hasattr(resource, "url"):
-                    request.childCacheURIs.append(resource.url())
+                if resource != self:
+                    if hasattr(resource, "owner_url"):
+                        request.childCacheURIs.append(resource.owner_url())
+                    elif hasattr(resource, "url"):
+                        request.childCacheURIs.append(resource.url())
         else:
             xml_response = davxml.StatusResponse(davxml.HRef(uri), davxml.Status.fromResponseCode(responsecode.FORBIDDEN))
 

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/stdconfig.py	2013-04-16 22:22:28 UTC (rev 11054)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/stdconfig.py	2013-04-16 22:23:56 UTC (rev 11055)
@@ -704,7 +704,6 @@
             "AttendeeRefreshBatchIntervalSeconds" : 5, # Time between attendee batch refreshes
             "UIDLockTimeoutSeconds"               : 60, # Time for implicit UID lock timeout
             "UIDLockExpirySeconds"                : 300, # Expiration time for UID lock,
-            "V1Compatibility"                     : False, # Allow /path-based CUAs in scheduling replies
             "PrincipalHostAliases"                : [], # Host names matched in http(s) CUAs
             "TimestampAttendeePartStatChanges"    : True, # Add a time stamp when an Attendee changes their PARTSTAT
 

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/storebridge.py	2013-04-16 22:22:28 UTC (rev 11054)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/storebridge.py	2013-04-16 22:23:56 UTC (rev 11055)
@@ -265,6 +265,13 @@
         return joinURL(self._parentResource.url(), self._name, "/")
 
 
+    def owner_url(self):
+        if self.isShareeCollection():
+            return joinURL(self._share.url(), "/")
+        else:
+            return self.url()
+
+
     def parentResource(self):
         return self._parentResource
 

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/test/test_icalendar.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/test/test_icalendar.py	2013-04-16 22:22:28 UTC (rev 11054)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/test/test_icalendar.py	2013-04-16 22:23:56 UTC (rev 11055)
@@ -7323,7 +7323,6 @@
     def test_normalizeCalendarUserAddressesFromUUID(self):
         """
         Ensure mailto is preferred, followed by path form, then http form.
-        If CALENDARSERVER-OLD-CUA parameter is present, restore that value.
         """
 
         data = """BEGIN:VCALENDAR
@@ -7335,7 +7334,6 @@
 ATTENDEE:urn:uuid:foo
 ATTENDEE:urn:uuid:bar
 ATTENDEE:urn:uuid:baz
-ATTENDEE;CALENDARSERVER-OLD-CUA="base64-aHR0cDovL2V4YW1wbGUuY29tL3ByaW5jaXBhbHMvdXNlcnMvYnV6":urn:uuid:buz
 DTSTAMP:20071114T000000Z
 END:VEVENT
 END:VCALENDAR
@@ -7361,11 +7359,6 @@
                     "baz",
                     ("urn:uuid:baz", "http://example.com/baz")
                 ),
-                "urn:uuid:buz" : (
-                    "Buz",
-                    "buz",
-                    ("urn:uuid:buz",)
-                ),
             }[cuaddr]
 
         component.normalizeCalendarUserAddresses(lookupFunction, None, toUUID=False)
@@ -7376,62 +7369,10 @@
             component.getAttendeeProperty(("/foo",)).value())
         self.assertEquals("http://example.com/baz",
             component.getAttendeeProperty(("http://example.com/baz",)).value())
-        self.assertEquals("http://example.com/principals/users/buz",
-            component.getAttendeeProperty(("http://example.com/principals/users/buz",)).value())
 
 
-    def test_normalizeCalendarUserAddressesToUUID(self):
-        """
-        Ensure http(s) and /path CUA values are tucked away into the property
-        using CALENDARSERVER-OLD-CUA parameter.
-        """
 
-        data = """BEGIN:VCALENDAR
-VERSION:2.0
-DTSTART:20071114T000000Z
-BEGIN:VEVENT
-UID:12345-67890
-DTSTART:20071114T000000Z
-ATTENDEE:/principals/users/foo
-ATTENDEE:http://example.com/principals/users/buz
-DTSTAMP:20071114T000000Z
-END:VEVENT
-END:VCALENDAR
-"""
 
-        component = Component.fromString(data)
-
-
-        def lookupFunction(cuaddr, ignored1, ignored2):
-            return {
-                "/principals/users/foo" : (
-                    "Foo",
-                    "foo",
-                    ("urn:uuid:foo",)
-                ),
-                "http://example.com/principals/users/buz" : (
-                    "Buz",
-                    "buz",
-                    ("urn:uuid:buz",)
-                ),
-            }[cuaddr]
-
-        self.patch(config.Scheduling.Options, "V1Compatibility", True)
-        component.normalizeCalendarUserAddresses(lookupFunction, None, toUUID=True)
-
-        # /principal CUAs are stored in CALENDARSERVER-OLD-CUA
-        prop = component.getAttendeeProperty(("urn:uuid:foo",))
-        self.assertEquals("urn:uuid:foo", prop.value())
-        self.assertEquals(prop.parameterValue("CALENDARSERVER-OLD-CUA"),
-            "base64-L3ByaW5jaXBhbHMvdXNlcnMvZm9v")
-
-        # http CUAs are stored in CALENDARSERVER-OLD-CUA
-        prop = component.getAttendeeProperty(("urn:uuid:buz",))
-        self.assertEquals("urn:uuid:buz", prop.value())
-        self.assertEquals(prop.parameterValue("CALENDARSERVER-OLD-CUA"),
-            "base64-aHR0cDovL2V4YW1wbGUuY29tL3ByaW5jaXBhbHMvdXNlcnMvYnV6")
-
-
     def test_normalizeCalendarUserAddressesAndLocationChange(self):
         """
         Ensure http(s) and /path CUA values are tucked away into the property

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/util.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/util.py	2013-04-16 22:22:28 UTC (rev 11054)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/util.py	2013-04-16 22:23:56 UTC (rev 11055)
@@ -464,11 +464,6 @@
         # to single-quotes.
         fullName = rec.fullName.replace('"', "'")
 
-        # TODO: remove V1Compatibility when V1 migration is complete
-        if config.Scheduling.Options.V1Compatibility:
-            # Allow /principals-form CUA
-            cuas = principal.calendarUserAddresses()
-        else:
-            cuas = principal.record.calendarUserAddresses
+        cuas = principal.record.calendarUserAddresses
 
         return (fullName, rec.guid, cuas)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130416/24532ed8/attachment-0001.html>


More information about the calendarserver-changes mailing list