[Zope-Checkins] SVN: Zope/branches/2.9/ Reduce the number of top-level modules from 4 to 2 by turning Globals

Philipp von Weitershausen philikon at philikon.de
Sun Nov 20 11:31:00 EST 2005


Log message for revision 40275:
  Reduce the number of top-level modules from 4 to 2 by turning Globals
  and Lifetime into packages.  The remaining two, Zope and ImageFile,
  will clean up themselves as they're slated for removal in Zope 2.11.
  

Changed:
  A   Zope/branches/2.9/lib/python/Globals/
  A   Zope/branches/2.9/lib/python/Globals/__init__.py
  D   Zope/branches/2.9/lib/python/Globals.py
  A   Zope/branches/2.9/lib/python/Lifetime/
  A   Zope/branches/2.9/lib/python/Lifetime/__init__.py
  D   Zope/branches/2.9/lib/python/Lifetime.py
  U   Zope/branches/2.9/releases/Zope2.map

-=-
Copied: Zope/branches/2.9/lib/python/Globals/__init__.py (from rev 40233, Zope/branches/2.9/lib/python/Globals.py)

Deleted: Zope/branches/2.9/lib/python/Globals.py
===================================================================
--- Zope/branches/2.9/lib/python/Globals.py	2005-11-20 16:02:35 UTC (rev 40274)
+++ Zope/branches/2.9/lib/python/Globals.py	2005-11-20 16:30:59 UTC (rev 40275)
@@ -1,53 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
-#
-##############################################################################
-
-"""Global definitions"""
-
-__version__='$Revision: 1.56 $'[11:-2]
-
-# Global constants: __replaceable__ flags:
-NOT_REPLACEABLE = 0
-REPLACEABLE = 1
-UNIQUE = 2
-
-import Acquisition, ComputedAttribute, App.PersistentExtra, os
-import TreeDisplay
-
-from App.Common import package_home, attrget, Dictionary
-from App.config import getConfiguration as _getConfiguration
-from Persistence import Persistent, PersistentMapping
-from App.special_dtml import HTML, HTMLFile, DTMLFile
-from App.class_init import default__class_init__, ApplicationDefaultPermissions
-
-# Nicer alias for class initializer.
-InitializeClass = default__class_init__
-
-from App.Dialogs import MessageDialog
-from App.ImageFile import ImageFile
-
-VersionNameName='Zope-Version'
-
-_cfg = _getConfiguration()
-data_dir = _cfg.clienthome
-
-# backward compatibility
-INSTANCE_HOME = _cfg.instancehome
-SOFTWARE_HOME = _cfg.softwarehome
-ZOPE_HOME = _cfg.zopehome
-
-opened=[]
-
-DevelopmentMode=_cfg.debug_mode
-
-del _cfg, _getConfiguration
-

Copied: Zope/branches/2.9/lib/python/Lifetime/__init__.py (from rev 40233, Zope/branches/2.9/lib/python/Lifetime.py)

Deleted: Zope/branches/2.9/lib/python/Lifetime.py
===================================================================
--- Zope/branches/2.9/lib/python/Lifetime.py	2005-11-20 16:02:35 UTC (rev 40274)
+++ Zope/branches/2.9/lib/python/Lifetime.py	2005-11-20 16:30:59 UTC (rev 40275)
@@ -1,83 +0,0 @@
-import sys, asyncore, time
-
-_shutdown_phase = 0
-_shutdown_timeout = 30 # seconds per phase
-
-# The shutdown phase counts up from 0 to 4.
-#
-# 0  Not yet terminating. running in main loop
-#
-# 1  Loss of service is imminent. Prepare any front-end proxies for this
-#    happening by stopping any ICP servers, so that they can choose to send
-#    requests to other Zope servers in the cluster.
-#
-# 2  Stop accepting any new requests.
-#
-# 3  Wait for all old requests to have been processed
-#
-# 4  Already terminated
-#
-# It is up to individual socket handlers to implement these actions, by
-# providing the 'clean_shutdown_control' method. This is called intermittantly
-# during shutdown with two parameters; the current phase number, and the amount
-# of time that it has currently been in that phase. This method should return
-# true if it does not yet want shutdown to proceed to the next phase.
-
-def shutdown(exit_code,fast = 0):
-    global _shutdown_phase
-    global _shutdown_timeout
-    if _shutdown_phase == 0:
-        # Thread safety? proably no need to care
-        import ZServer
-        ZServer.exit_code = exit_code
-        _shutdown_phase = 1
-    if fast:
-        # Someone wants us to shutdown fast. This is hooked into SIGTERM - so
-        # possibly the system is going down and we can expect a SIGKILL within
-        # a few seconds.  Limit each shutdown phase to one second. This is fast
-        # enough, but still clean.
-        _shutdown_timeout = 1.0
-
-def loop():
-    # Run the main loop until someone calls shutdown()
-    lifetime_loop()
-    # Gradually close sockets in the right order, while running a select
-    # loop to allow remaining requests to trickle away.
-    graceful_shutdown_loop()
-
-def lifetime_loop():
-    # The main loop. Stay in here until we need to shutdown
-    map = asyncore.socket_map
-    timeout = 30.0
-    while map and _shutdown_phase == 0:
-        asyncore.poll(timeout, map)
-
-        
-def graceful_shutdown_loop():
-    # The shutdown loop. Allow various services to shutdown gradually.
-    global _shutdown_phase
-    timestamp = time.time()
-    timeout = 1.0
-    map = asyncore.socket_map
-    while map and _shutdown_phase < 4:
-        time_in_this_phase = time.time()-timestamp 
-        veto = 0
-        for fd,obj in map.items():
-            try:
-                fn = getattr(obj,'clean_shutdown_control')
-            except AttributeError:
-                pass
-            else:
-                try:
-                    veto = veto or fn(_shutdown_phase,time_in_this_phase)
-                except:
-                    obj.handle_error()
-        if veto and time_in_this_phase<_shutdown_timeout:
-            # Any open socket handler can veto moving on to the next shutdown
-            # phase.  (but not forever)
-            asyncore.poll(timeout, map)
-        else:
-            # No vetos? That is one step closer to shutting down
-            _shutdown_phase += 1
-            timestamp = time.time()
-    

Modified: Zope/branches/2.9/releases/Zope2.map
===================================================================
--- Zope/branches/2.9/releases/Zope2.map	2005-11-20 16:02:35 UTC (rev 40274)
+++ Zope/branches/2.9/releases/Zope2.map	2005-11-20 16:30:59 UTC (rev 40275)
@@ -29,11 +29,11 @@
 DateTime          ../lib/python/DateTime
 DocumentTemplate  ../lib/python/DocumentTemplate
 ExtensionClass    ../lib/python/ExtensionClass
-Globals           ../lib/python/Globals.py
+Globals           ../lib/python/Globals
 HelpSys           ../lib/python/HelpSys
 ImageFile         ../lib/python/ImageFile.py
 Interface         ../lib/python/Interface
-Lifetime          ../lib/python/Lifetime.py
+Lifetime          ../lib/python/Lifetime
 MethodObject      ../lib/python/MethodObject
 Missing           ../lib/python/Missing
 MultiMapping      ../lib/python/MultiMapping



More information about the Zope-Checkins mailing list