[Zope-Checkins] CVS: Zope/lib/python/App - ApplicationManager.py:1.81.4.1 CacheManager.py:1.26.4.2 Common.py:1.15.4.8
Chris McDonough
chrism@zope.com
Sun, 24 Nov 2002 18:32:02 -0500
Update of /cvs-repository/Zope/lib/python/App
In directory cvs.zope.org:/tmp/cvs-serv7594
Modified Files:
Tag: chrism-install-branch
ApplicationManager.py CacheManager.py Common.py
Log Message:
Merge with HEAD.
=== Zope/lib/python/App/ApplicationManager.py 1.81 => 1.81.4.1 ===
--- Zope/lib/python/App/ApplicationManager.py:1.81 Wed Aug 14 17:31:40 2002
+++ Zope/lib/python/App/ApplicationManager.py Sun Nov 24 18:32:01 2002
@@ -11,8 +11,8 @@
#
##############################################################################
__doc__="""System management components"""
-__version__='$Revision$'[11:-2]
+__version__='$Revision$'[11:-2]
import sys,os,time,Globals, Acquisition, os, Undo
from Globals import DTMLFile
@@ -28,6 +28,7 @@
from cStringIO import StringIO
from AccessControl import getSecurityManager
import zLOG
+import Lifetime
try: import thread
except: get_ident=lambda: 0
@@ -175,15 +176,19 @@
manage_profile=DTMLFile('dtml/profile', globals())
- def manage_profile_stats(self, sort='time', limit=200):
+ def manage_profile_stats(self, sort='time', limit=200, stripDirs=1, mode='stats'):
"""Return profile data if available"""
stats=getattr(sys, '_ps_', None)
if stats is None:
return None
output=StringIO()
stdout=sys.stdout
+ if stripDirs:
+ from copy import copy; stats= copy(stats)
+ stats.strip_dirs()
+ stats.sort_stats(sort)
sys.stdout=output
- stats.strip_dirs().sort_stats(sort).print_stats(limit)
+ getattr(stats,'print_%s' % mode)(limit)
sys.stdout.flush()
sys.stdout=stdout
return output.getvalue()
@@ -325,13 +330,13 @@
user = 'unknown user'
zLOG.LOG("ApplicationManager", zLOG.INFO,
"Restart requested by %s" % user)
- for db in Globals.opened: db.close()
- raise SystemExit, """<html>
+ #for db in Globals.opened: db.close()
+ Lifetime.shutdown(1)
+ return """<html>
<head><meta HTTP-EQUIV=REFRESH CONTENT="5; URL=%s/manage_main">
</head>
<body>Zope is restarting</body></html>
""" % URL1
- sys.exit(1)
def manage_shutdown(self):
"""Shut down the application"""
@@ -341,8 +346,13 @@
user = 'unknown user'
zLOG.LOG("ApplicationManager", zLOG.INFO,
"Shutdown requested by %s" % user)
- for db in Globals.opened: db.close()
- sys.exit(0)
+ #for db in Globals.opened: db.close()
+ Lifetime.shutdown(0)
+ return """<html>
+ <head>
+ </head>
+ <body>Zope is shutting down</body></html>
+ """
def manage_pack(self, days=0, REQUEST=None):
"""Pack the database"""
=== Zope/lib/python/App/CacheManager.py 1.26.4.1 => 1.26.4.2 ===
=== Zope/lib/python/App/Common.py 1.15.4.7 => 1.15.4.8 ===
--- Zope/lib/python/App/Common.py:1.15.4.7 Sat Oct 26 15:51:37 2002
+++ Zope/lib/python/App/Common.py Sun Nov 24 18:32:01 2002
@@ -90,7 +90,9 @@
# Use __getitem__ as opposed to has_key to avoid TTW namespace
# issues, and to support the most minimal mapping objects
try:
- if aq_base(parent[absId]) is aq_base(ob):
+ # We assume that getitem will not acquire which
+ # is the standard behavior for Zope objects
+ if aq_base(ob.aq_parent[absId]) is aq_base(ob):
# This object is an item of the aq_parent, its not acquired
return 0
except KeyError: