[Zope-CVS] CVS: Products/DBTab - ControlPanelPatch.py:1.2 MainConfiguration.py:1.3

Shane Hathaway shane@zope.com
Thu, 17 Oct 2002 16:44:18 -0400


Update of /cvs-repository/Products/DBTab
In directory cvs.zope.org:/tmp/cvs-serv23786

Modified Files:
	ControlPanelPatch.py MainConfiguration.py 
Log Message:
Moved the CacheManager patch back to where it was previously.  In the new
place, the cache size was being overridden by the database.


=== Products/DBTab/ControlPanelPatch.py 1.1 => 1.2 ===
--- Products/DBTab/ControlPanelPatch.py:1.1	Wed Oct 16 17:13:04 2002
+++ Products/DBTab/ControlPanelPatch.py	Thu Oct 17 16:44:18 2002
@@ -25,7 +25,6 @@
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 
 from MainConfiguration import configuration
-from Exceptions import DBTabOverrideError
 
 
 class AltDatabaseManager(DatabaseManager, CacheManager):
@@ -99,25 +98,3 @@
     # Replace the "Database" control panel with a database chooser
     chooser = DatabaseChooser('Database')
     ApplicationManager.Database = chooser
-
-
-if 1:
-    # Patch CacheManager so it no longer sets database cache parameters.
-    # In theory, cache parameters are better managed by a configuration file.
-    def my_initialize_cache(self):
-        " "
-        pass
-
-    def my_manage_cache_size(self, value, REQUEST):
-        " "
-        raise DBTabOverrideError(
-            "Database cache settings must be managed through dbtab.conf.")
-
-    def my_cache_size(self):
-        " "
-        return self._p_jar.db().getCacheSize()
-
-    CacheManager.initialize_cache = my_initialize_cache
-    CacheManager.manage_cache_size = my_manage_cache_size
-    CacheManager.cache_size = my_cache_size
-


=== Products/DBTab/MainConfiguration.py 1.2 => 1.3 ===
--- Products/DBTab/MainConfiguration.py:1.2	Wed Oct 16 17:13:04 2002
+++ Products/DBTab/MainConfiguration.py	Thu Oct 17 16:44:18 2002
@@ -19,6 +19,7 @@
 import os
 
 from DBTab import DBTab
+from Exceptions import DBTabOverrideError
 
 # Read the configuration from $INSTANCE_HOME/dbtab.conf if available,
 # otherwise fall back to dbtab.conf.in.
@@ -28,4 +29,27 @@
 configuration = DBTab([main_fn], [fallback_fn])
 
 configuration.startup()
+
+
+if 1:
+    # Patch App.CacheManager so it no longer sets database cache parameters.
+    # In theory, cache parameters are better managed by a configuration file.
+    from App.CacheManager import CacheManager
+
+    def my_initialize_cache(self):
+        " "
+        pass
+
+    def my_manage_cache_size(self, value, REQUEST):
+        " "
+        raise DBTabOverrideError(
+            "Database cache settings must be managed through dbtab.conf.")
+
+    def my_cache_size(self):
+        " "
+        return self._p_jar.db().getCacheSize()
+
+    CacheManager.initialize_cache = my_initialize_cache
+    CacheManager.manage_cache_size = my_manage_cache_size
+    CacheManager.cache_size = my_cache_size