[CalendarServer-changes] [4916] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Mon Jan 11 12:48:17 PST 2010


Revision: 4916
          http://trac.macosforge.org/projects/calendarserver/changeset/4916
Author:   cdaboo at apple.com
Date:     2010-01-11 12:48:15 -0800 (Mon, 11 Jan 2010)
Log Message:
-----------
Need to bypass memcachelock processType check during unit tests.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/memcacher.py
    CalendarServer/trunk/twistedcaldav/test/util.py

Modified: CalendarServer/trunk/twistedcaldav/memcacher.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/memcacher.py	2010-01-11 15:09:15 UTC (rev 4915)
+++ CalendarServer/trunk/twistedcaldav/memcacher.py	2010-01-11 20:48:15 UTC (rev 4916)
@@ -33,6 +33,8 @@
     # Translation table: all ctrls (0x00 - 0x1F) and space and 0x7F mapped to _
     keyNormalizeTranslateTable = string.maketrans("".join([chr(i) for i in range(33)]) + chr(0x7F), "_"*33 + "_")
 
+    allowTestCache = False
+
     class memoryCacher():
         """
         A class implementing the memcache client API we care about but
@@ -117,7 +119,7 @@
         if config.Memcached['ClientEnabled']:
             self._memcacheProtocol = self.getCachePool()
 
-        elif config.ProcessType == "Single" or self._noInvalidation:
+        elif config.ProcessType == "Single" or self._noInvalidation or self.allowTestCache:
             # NB no need to pickle the memory cacher as it handles python types natively
             self._memcacheProtocol = Memcacher.memoryCacher()
             self._pickle = False

Modified: CalendarServer/trunk/twistedcaldav/test/util.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/util.py	2010-01-11 15:09:15 UTC (rev 4915)
+++ CalendarServer/trunk/twistedcaldav/test/util.py	2010-01-11 20:48:15 UTC (rev 4916)
@@ -23,6 +23,7 @@
 from twisted.internet.defer import succeed, fail
 from twisted.web2.http import HTTPError, StatusResponse
 
+from twistedcaldav import memcacher
 from twistedcaldav.config import config
 from twistedcaldav.static import CalDAVFile
 import memcacheclient
@@ -44,6 +45,7 @@
         config.Memcached.ClientEnabled = False
         config.Memcached.ServerEnabled = False
         memcacheclient.ClientFactory.allowTestCache = True
+        memcacher.Memcacher.allowTestCache = True
 
     def createHierarchy(self, structure, root=None):
         if root is None:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100111/584e0de9/attachment.html>


More information about the calendarserver-changes mailing list