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

source_changes at macosforge.org source_changes at macosforge.org
Tue Mar 25 10:48:03 PDT 2008


Revision: 2243
          http://trac.macosforge.org/projects/calendarserver/changeset/2243
Author:   cdaboo at apple.com
Date:     2008-03-25 10:48:03 -0700 (Tue, 25 Mar 2008)

Log Message:
-----------
Tweak needed to make unittests work. We need a reliable way to turn the timezone cache behavior
off so we can check the failure mode. We also need to make sure that the timezone cache only
activates once in anyone python session. When unit tests are used tap.py is called multiple times
to register a cache, but there is nothing to unregister it - so now we make sure multiple tap.py's
only ever cause one timezone cach to be used.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/tap.py
    CalendarServer/trunk/twistedcaldav/test/test_timezones.py
    CalendarServer/trunk/twistedcaldav/timezones.py

Modified: CalendarServer/trunk/twistedcaldav/tap.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/tap.py	2008-03-21 17:44:00 UTC (rev 2242)
+++ CalendarServer/trunk/twistedcaldav/tap.py	2008-03-25 17:48:03 UTC (rev 2243)
@@ -561,7 +561,7 @@
         # Configure ancillary data
         #
         logging.info("Setting up Timezone Cache", system="startup")
-        TimezoneCache().register()
+        TimezoneCache.create()
 
         #
         # Configure the Site and Wrappers

Modified: CalendarServer/trunk/twistedcaldav/test/test_timezones.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_timezones.py	2008-03-21 17:44:00 UTC (rev 2242)
+++ CalendarServer/trunk/twistedcaldav/test/test_timezones.py	2008-03-25 17:48:03 UTC (rev 2243)
@@ -69,6 +69,9 @@
         """
         Properties in components
         """
+        if TimezoneCache.activeCache:
+            TimezoneCache.activeCache.unregister()
+
         registerTzid("America/New_York", None)
         self.doTest(
             "TruncatedApr01.ics",

Modified: CalendarServer/trunk/twistedcaldav/timezones.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/timezones.py	2008-03-21 17:44:00 UTC (rev 2242)
+++ CalendarServer/trunk/twistedcaldav/timezones.py	2008-03-25 17:48:03 UTC (rev 2243)
@@ -48,6 +48,15 @@
     pass
 
 class TimezoneCache(object):
+    
+    activeCache = None
+
+    @staticmethod
+    def create():
+        if TimezoneCache.activeCache is None:
+            TimezoneCache.activeCache = TimezoneCache()
+            TimezoneCache.activeCache.register()
+        
     def __init__(self):
         self._caching = False
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080325/eb04d6c4/attachment.html 


More information about the calendarserver-changes mailing list