[Zodb-checkins] CVS: Zope/utilities/ZODBTools - zodbload.py:1.2.2.2

Jim Fulton jim at zope.com
Thu Oct 2 15:16:10 EDT 2003


Update of /cvs-repository/Zope/utilities/ZODBTools
In directory cvs.zope.org:/tmp/cvs-serv29198

Modified Files:
      Tag: Zope-2_7-branch
	zodbload.py 
Log Message:
Changed to work with Zope 2.7's initialization mechanisms.


=== Zope/utilities/ZODBTools/zodbload.py 1.2.2.1 => 1.2.2.2 ===
--- Zope/utilities/ZODBTools/zodbload.py:1.2.2.1	Mon Sep 15 14:03:02 2003
+++ Zope/utilities/ZODBTools/zodbload.py	Thu Oct  2 15:16:09 2003
@@ -724,6 +724,13 @@
     if options["mbox"]:
         mboxes[options["mbox"]] = MBox(options["mbox"])
 
+    # ZConfig processes command-line arguments for it's own purposes.
+    # We need to hide ours, which it doesn't understand.
+    del sys.argv[1:]
+
+    # Perform a ZConfig-based Zope initialization:
+    zetup(os.path.join(lib_python, '..', '..', 'etc', 'zope.conf'))
+
     if options.has_key('setup'):
         setup(lib_python)
     else:
@@ -762,6 +769,20 @@
             thread.join()
     else:
         run(jobs)
+
+
+def zetup(configfile_name):
+    from Zope.Startup.options import ZopeOptions
+    from Zope.Startup import handlers as h
+    from App import config
+    opts=ZopeOptions()
+    opts.configfile=configfile_name
+    opts.realize()
+    h.handleConfig(opts.configroot,opts.confighandlers)
+    config.setConfiguration(opts.configroot)
+    from Zope.Startup import dropPrivileges
+    dropPrivileges(opts.configroot)
+
 
 
 if __name__ == '__main__':




More information about the Zodb-checkins mailing list