[Checkins] SVN: Zope/branches/tseaver-zope.app_delenda_est/ No longer depend on ``zope.app.appsetup``.

Tres Seaver tseaver at palladion.com
Wed May 13 15:42:15 EDT 2009


Log message for revision 99913:
  No longer depend on ``zope.app.appsetup``.
  
  Use the event implementations from ``zope.processlifetime`` instead.
  

Changed:
  U   Zope/branches/tseaver-zope.app_delenda_est/doc/CHANGES.rst
  U   Zope/branches/tseaver-zope.app_delenda_est/setup.py
  U   Zope/branches/tseaver-zope.app_delenda_est/src/Zope2/App/startup.py
  U   Zope/branches/tseaver-zope.app_delenda_est/src/Zope2/Startup/__init__.py
  U   Zope/branches/tseaver-zope.app_delenda_est/versions.cfg

-=-
Modified: Zope/branches/tseaver-zope.app_delenda_est/doc/CHANGES.rst
===================================================================
--- Zope/branches/tseaver-zope.app_delenda_est/doc/CHANGES.rst	2009-05-13 19:40:18 UTC (rev 99912)
+++ Zope/branches/tseaver-zope.app_delenda_est/doc/CHANGES.rst	2009-05-13 19:42:15 UTC (rev 99913)
@@ -8,6 +8,12 @@
 Trunk (unreleased)
 ------------------
 
+Restructuring
++++++++++++++
+
+- No longer depend on ``zope.app.appsetup``;  use the event implementations
+  from ``zope.processlifetime`` instead.
+
 Features Added
 ++++++++++++++
 

Modified: Zope/branches/tseaver-zope.app_delenda_est/setup.py
===================================================================
--- Zope/branches/tseaver-zope.app_delenda_est/setup.py	2009-05-13 19:40:18 UTC (rev 99912)
+++ Zope/branches/tseaver-zope.app_delenda_est/setup.py	2009-05-13 19:42:15 UTC (rev 99913)
@@ -19,7 +19,7 @@
 EXTENSIONCLASS_INCLUDEDIRS = ['include', 'src']
 
 params = dict(name='Zope2',
-    version='2.12.0b1',
+    version='2.12.0b2dev',
     url='http://www.zope.org',
     license='ZPL 2.1',
     description='Zope2 application server / web framework',
@@ -128,6 +128,7 @@
       'zope.lifecycleevent',
       'zope.location',
       'zope.pagetemplate',
+      'zope.processlifetime',
       'zope.proxy',
       'zope.publisher',
       'zope.schema',

Modified: Zope/branches/tseaver-zope.app_delenda_est/src/Zope2/App/startup.py
===================================================================
--- Zope/branches/tseaver-zope.app_delenda_est/src/Zope2/App/startup.py	2009-05-13 19:40:18 UTC (rev 99912)
+++ Zope/branches/tseaver-zope.app_delenda_est/src/Zope2/App/startup.py	2009-05-13 19:42:15 UTC (rev 99913)
@@ -39,7 +39,7 @@
 import ZPublisher
 
 from zope.event import notify
-from zope.app import appsetup
+from zope.processlifetime import DatabaseOpened
 
 app = None
 startup_time = asctime()
@@ -82,7 +82,7 @@
         else:
             DB = ZODB.DB(m.Storage, databases=databases)
 
-    notify(appsetup.interfaces.DatabaseOpened(DB))
+    notify(DatabaseOpened(DB))
 
     Globals.BobobaseName = DB.getName()
 

Modified: Zope/branches/tseaver-zope.app_delenda_est/src/Zope2/Startup/__init__.py
===================================================================
--- Zope/branches/tseaver-zope.app_delenda_est/src/Zope2/Startup/__init__.py	2009-05-13 19:40:18 UTC (rev 99912)
+++ Zope/branches/tseaver-zope.app_delenda_est/src/Zope2/Startup/__init__.py	2009-05-13 19:42:15 UTC (rev 99913)
@@ -11,27 +11,25 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-
-""" Startup package.  Responsible for startup configuration of Zope """
-
+""" Startup package.  Responsible for startup configuration of Zope.
+"""
 import logging
 import os
+from re import compile
 import sys
 import socket
-from re import compile
-from socket import gethostbyaddr
-try:
+
+try: # XXX:  YAGNI
     import twisted.internet.reactor
     _use_twisted = True
 except ImportError:
     _use_twisted = True
     
-
-import ZConfig
+from ZConfig import ConfigurationError
 from ZConfig.components.logger import loghandler
 
 from zope.event import notify
-from zope.app import appsetup
+from zope.processlifetime import ProcessStarting
 
 logger = logging.getLogger("Zope")
 started = False
@@ -73,7 +71,7 @@
 
 
     def sendEvents(self):
-        notify(appsetup.interfaces.ProcessStarting())
+        notify(ProcessStarting())
 
     def prepare(self):
         self.setupInitialLogging()
@@ -110,11 +108,11 @@
             config = getConfiguration()
             import ZServer
             if config.twisted_servers and config.servers:
-                raise ZConfig.ConfigurationError(
+                raise ConfigurationError(
                     "You can't run both ZServer servers and twisted servers.")
-            if config.twisted_servers:
+            if config.twisted_servers: # XXX: YAGNI
                 if not _use_twisted:
-                    raise ZConfig.ConfigurationError(
+                    raise ConfigurationError(
                         "You do not have twisted installed.")
                 twisted.internet.reactor.run()
                 # Storing the exit code in the ZServer even for twisted, 
@@ -183,7 +181,7 @@
             try:
                 import locale
             except:
-                raise ZConfig.ConfigurationError(
+                raise ConfigurationError(
                     'The locale module could not be imported.\n'
                     'To use localization options, you must ensure\n'
                     'that the locale module is compiled into your\n'
@@ -192,7 +190,7 @@
             try:
                 locale.setlocale(locale.LC_ALL, locale_id)
             except:
-                raise ZConfig.ConfigurationError(
+                raise ConfigurationError(
                     'The specified locale "%s" is not supported by your'
                     'system.\nSee your operating system documentation for '
                     'more\ninformation on locale support.' % locale_id
@@ -231,8 +229,8 @@
             try:
                 servers.append(server.create())
             except socket.error,e:
-                raise ZConfig.ConfigurationError(socket_err
-                                                 % (server.servertype(),e[1]))
+                raise ConfigurationError(socket_err
+                                           % (server.servertype(),e[1]))
         self.cfg.servers = servers
 
     def dropPrivileges(self):
@@ -382,9 +380,10 @@
     python_version = sys.version.split()[0]
     optimum_version = '2.3.4'
     if python_version < '2.3.4':
-        raise ZConfig.ConfigurationError(
-            'Invalid python version: %s, the optimal version is %s or higher' %
-            (python_version, optimum_version))
+        raise ConfigurationError(
+                    'Invalid python version: %s; '
+                    'the optimal version is %s or higher' %
+                        (python_version, optimum_version))
 
 
 def dropPrivileges(cfg):
@@ -405,7 +404,7 @@
                'start as root (change the effective-user directive '
                'in zope.conf)')
         logger.critical(msg)
-        raise ZConfig.ConfigurationError(msg)
+        raise ConfigurationError(msg)
 
     try:
         uid = int(effective_user)
@@ -415,7 +414,7 @@
         except KeyError:
             msg = "Can't find username %r" % effective_user
             logger.error(msg)
-            raise ZConfig.ConfigurationError(msg)
+            raise ConfigurationError(msg)
         uid = pwrec[2]
     else:
         try:
@@ -423,13 +422,13 @@
         except KeyError:
             msg = "Can't find uid %r" % uid
             logger.error(msg)
-            raise ZConfig.ConfigurationError(msg)
+            raise ConfigurationError(msg)
     gid = pwrec[3]
 
     if uid == 0:
         msg = 'Cannot start Zope with the effective user as the root user'
         logger.error(msg)
-        raise ZConfig.ConfigurationError(msg)
+        raise ConfigurationError(msg)
 
     try:
         import initgroups
@@ -451,4 +450,4 @@
     identify it by its ip (and not the host name).
     '''
     if isIp_(host): return [host]
-    return gethostbyaddr(host)[2]
+    return socket.gethostbyaddr(host)[2]

Modified: Zope/branches/tseaver-zope.app_delenda_est/versions.cfg
===================================================================
--- Zope/branches/tseaver-zope.app_delenda_est/versions.cfg	2009-05-13 19:40:18 UTC (rev 99912)
+++ Zope/branches/tseaver-zope.app_delenda_est/versions.cfg	2009-05-13 19:42:15 UTC (rev 99913)
@@ -30,7 +30,6 @@
 zope.annotation = 3.4.2
 zope.app.apidoc = 3.6.2
 zope.app.applicationcontrol = 3.4.3
-zope.app.appsetup = 3.10.1
 zope.app.basicskin = 3.4.0
 zope.app.broken = 3.5.0
 zope.app.cache = 3.5.0
@@ -110,6 +109,7 @@
 zope.pagetemplate = 3.4.2
 zope.principalannotation = 3.6.0
 zope.principalregistry = 3.7.0
+zope.processlifetime = 1.0
 zope.proxy = 3.5.0
 zope.publisher = 3.6.4
 zope.schema = 3.5.4



More information about the Checkins mailing list