[Zodb-checkins] CVS: Zope/lib/python/zdaemon - zdoptions.py:1.16

Fred L. Drake, Jr. fred@zope.com
Wed, 5 Feb 2003 13:44:11 -0500


Update of /cvs-repository/Zope/lib/python/zdaemon
In directory cvs.zope.org:/tmp/cvs-serv11004

Modified Files:
	zdoptions.py 
Log Message:
Move schema-loading to a helper method so applications can load the
schema earlier if they need to (for example, to get the datatype
registry).


=== Zope/lib/python/zdaemon/zdoptions.py 1.15 => 1.16 ===
--- Zope/lib/python/zdaemon/zdoptions.py:1.15	Mon Jan 27 10:13:17 2003
+++ Zope/lib/python/zdaemon/zdoptions.py	Wed Feb  5 13:44:06 2003
@@ -212,14 +212,7 @@
 
         if self.configfile is not None:
             # Process config file
-            if self.schema is None:
-                # Load schema
-                if self.schemadir is None:
-                    self.schemadir = os.path.dirname(__file__)
-                self.schemafile = os.path.join(self.schemadir, self.schemafile)
-                self.schema = ZConfig.loadSchema(self.schemafile)
-
-            # Load configuration
+            self.load_schema()
             try:
                 self.configroot, xxx = ZConfig.loadConfig(self.schema,
                                                           self.configfile)
@@ -254,6 +247,14 @@
             if (os.getenv("EVENT_LOG_FILE") is None and
                 os.getenv("STUPID_LOG_FILE") is None):
                 self.load_logconf(self.logsectionname)
+
+    def load_schema(self):
+        if self.schema is None:
+            # Load schema
+            if self.schemadir is None:
+                self.schemadir = os.path.dirname(__file__)
+            self.schemafile = os.path.join(self.schemadir, self.schemafile)
+            self.schema = ZConfig.loadSchema(self.schemafile)
 
     def load_logconf(self, sectname="eventlog"):
         parts = sectname.split(".")