[Zope-Checkins] CVS: Zope/lib/python/App - CacheManager.py:1.23.18.1 Common.py:1.11.18.1 FindHomes.py:1.8.18.1
Casey Duncan
casey@zope.com
Wed, 27 Mar 2002 15:52:06 -0500
Update of /cvs-repository/Zope/lib/python/App
In directory cvs.zope.org:/tmp/cvs-serv22094/lib/python/App
Modified Files:
Tag: casey-death_to_index_html-branch
CacheManager.py Common.py FindHomes.py
Log Message:
Updating branch to head for testing
=== Zope/lib/python/App/CacheManager.py 1.23 => 1.23.18.1 ===
else: return db.cacheSize()
+ def cache_detail_length(self):
+ try: db=self._p_jar.db()
+ except:
+ return ()
+ else: return db.cacheDetailSize()
+
def database_size(self):
try: db=self._p_jar.db()
except:
@@ -156,7 +162,7 @@
response=REQUEST['RESPONSE']
response.redirect(REQUEST['URL1']+'/manage_cacheGC')
- def manage_minimize(self,value,REQUEST):
+ def manage_minimize(self,value=1,REQUEST=None):
"Perform a full sweep through the cache"
try: db=self._p_jar.db()
except:
@@ -206,7 +212,6 @@
# sort the list.
lst = map(lambda dict: ((dict['conn_no'], dict['oid']), dict),
detail)
- lst.sort()
# format as text.
res = [
'# Table shows connection number, oid, refcount, state, '
=== Zope/lib/python/App/Common.py 1.11 => 1.11.18.1 ===
def Dictionary(**kw): return kw # Sorry Guido
+def realpath(p):
+ """ Computes the 'real' path of a file or directory devoid of
+ any symlink in any element of the path """
+ p = os.path.abspath(p)
+ if os.name == 'posix':
+ path_list = p.split(os.sep)
+ orig_len = len(path_list)
+ changed = 0
+ i = 1
+ while not changed and i < orig_len:
+ head = path_list[:i]
+ tail = path_list[i:]
+ head_s = os.sep.join(head)
+ tail_s = os.sep.join(tail)
+ if os.path.islink(head_s):
+ head_s = os.readlink(head_s)
+ path_list = head_s.split(os.sep)
+ path_list.extend(tail)
+ p = os.sep.join(path_list)
+ p = realpath(p)
+ changed = 1
+ i = i + 1
+ return p
=== Zope/lib/python/App/FindHomes.py 1.8 => 1.8.18.1 ===
import os, sys, Products
-from Common import package_home
+from Common import package_home, realpath
path_join = os.path.join
path_split = os.path.split
@@ -31,10 +31,12 @@
if path_split(home)[1]=='..':
home=path_split(path_split(home)[0])[0]
+home=realpath(home)
sys.modules['__builtin__'].SOFTWARE_HOME=SOFTWARE_HOME=home
try:
chome=os.environ['INSTANCE_HOME']
+ chome = realpath(chome)
except:
chome=home
d,e=path_split(chome)