Commit ffbe3537 authored by Jim Fulton's avatar Jim Fulton

Changed many files to work with BoboPOS 2 and ZODB 3 to ease

the transaction between the two. Also tried to clean a number
of things up (in preparation for the move). Rearranged things,
moving alot of code out of Globals into other modules.
Migrates some modules into packages and did away with the
infamous Scheduler.
parent b4107037
......@@ -83,7 +83,7 @@
#
##############################################################################
__doc__="""System management components"""
__version__='$Revision: 1.42 $'[11:-2]
__version__='$Revision: 1.43 $'[11:-2]
import sys,os,time,string,Globals, Acquisition
......@@ -205,7 +205,14 @@ class ApplicationManager(Folder,CacheManager):
s='%d sec' % s
return '%s %s %s %s' % (d, h, m, s)
def db_name(self): return Globals.Bobobase._jar.db.file_name
def db_name(self):
try: db=self._p_jar.db()
except:
# BoboPOS 2
return Globals.BobobaseName
else:
# ZODB 3
return db.getName()
def db_size(self):
s=os.stat(self.db_name())[6]
......@@ -214,21 +221,23 @@ class ApplicationManager(Folder,CacheManager):
def manage_shutdown(self):
"""Shut down the application"""
db=Globals.Bobobase._jar.db
db.save_index()
db.file.close()
db=Globals.VersionBase.TDB
db.save_index()
db.file.close()
for db in Globals.opened: db.close()
sys.exit(0)
def manage_pack(self, days=0, REQUEST=None):
"""Pack the database"""
t=time.time()-days*86400
try: db=self._p_jar.db()
except: pass
else: return db.pack(t)
# BoboPOS2:
if self._p_jar.db is not Globals.Bobobase._jar.db:
raise 'Version Error', (
'''You may not pack the application database while
working in a <em>version</em>''')
t=time.time()-days*86400
if Globals.Bobobase.has_key('_pack_time'):
since=Globals.Bobobase['_pack_time']
if t <= since:
......
......@@ -85,8 +85,8 @@
__doc__='''Cache management support
$Id: CacheManager.py,v 1.12 1999/03/22 18:13:41 michel Exp $'''
__version__='$Revision: 1.12 $'[11:-2]
$Id: CacheManager.py,v 1.13 1999/04/29 19:16:03 jim Exp $'''
__version__='$Revision: 1.13 $'[11:-2]
import Globals, time, sys
......@@ -95,17 +95,49 @@ class CacheManager:
"""
_cache_age=60
_cache_size=400
_vcache_age=60
_vcache_size=400
manage_cacheParameters=Globals.HTMLFile('cacheParameters', globals())
manage_cacheGC=Globals.HTMLFile('cacheGC', globals())
def cache_length(self): return len(Globals.Bobobase._jar.cache)
def cache_length(self):
try: db=self._p_jar.db()
except:
# BoboPOS2
return len(Globals.Bobobase._jar.cache)
else: return db.cacheSize()
def database_size(self): return len(Globals.Bobobase._jar.db.index)*4
def database_size(self):
try: db=self._p_jar.db()
except:
# BoboPOS2
return len(Globals.Bobobase._jar.db.index)*4
else: return db.getSize()
def cache_age(self):
try:
if self._p_jar.getVersion():
return self._vcache_age
except: pass
return self._cache_age
def cache_age(self): return self._cache_age
def manage_cache_age(self,value,REQUEST):
"set cache age"
try:
v=self._p_jar.getVersion()
except: pass
else:
if v:
self._vcache_age=value
self._p_jar.db().setVersionCacheDeactivateAfter(value)
else:
self._cache_age=value
self._p_jar.db().setCacheDeactivateAfter(value)
return
# BoboPOS2:
if self._p_jar.db is not Globals.Bobobase._jar.db:
raise 'Version Error', (
'''You may not change the database cache age
......@@ -113,9 +145,29 @@ class CacheManager:
self._cache_age=Globals.Bobobase._jar.cache.cache_age=value
return self.manage_CacheParameters(self,REQUEST)
def cache_size(self): return self._cache_size
def cache_size(self):
try:
if self._p_jar.getVersion():
return self._vcache_size
except: pass
return self._cache_size
def manage_cache_size(self,value,REQUEST):
"set cache size"
try:
v=self._p_jar.getVersion()
except: pass
else:
if v:
self._vcache_size=value
self._p_jar.db().setVersionCacheSize(value)
else:
self._cache_size=value
self._p_jar.db().setCacheSize(value)
return
# BoboPOS2:
if self._p_jar.db is not Globals.Bobobase._jar.db:
raise 'Version Error', (
'''You may not change the database cache size
......@@ -123,61 +175,128 @@ class CacheManager:
self._cache_size=Globals.Bobobase._jar.cache.cache_size=value
return self.manage_cacheParameters(self,REQUEST)
def cacheStatistics(self):
try: return self._p_jar.db().cacheStatistics()
except: pass
# BoboPOS 2
return (
('Mean time since last access (minutes)',
"%.4g" % (Globals.Bobobase._jar.cache.cache_mean_age/60.0)),
('Deallocation rate (objects/minute)',
"%.4g" % (Globals.Bobobase._jar.cache.cache_mean_deal*60)),
('Deactivation rate (objects/minute)',
"%.4g" % (Globals.Bobobase._jar.cache.cache_mean_deac*60)),
('Time of last cache garbage collection',
time.asctime(time.localtime(
Globals.Bobobase._jar.cache.cache_last_gc_time
))
),
)
# BoboPOS 2
def cache_mean_age(self):
return Globals.Bobobase._jar.cache.cache_mean_age/60.0
# BoboPOS 2
def cache_mean_deal(self):
return Globals.Bobobase._jar.cache.cache_mean_deal*60
# BoboPOS 2
def cache_mean_deac(self):
return Globals.Bobobase._jar.cache.cache_mean_deac*60
# BoboPOS 2
def cache_last_gc_time(self):
t=Globals.Bobobase._jar.cache.cache_last_gc_time
return time.asctime(time.localtime(t))
def manage_full_sweep(self,value,REQUEST):
"Perform a full sweep through the cache"
Globals.Bobobase._jar.cache.full_sweep(value)
try: db=self._p_jar.db()
except:
# BoboPOS2
Globals.Bobobase._jar.cache.full_sweep(value)
else: db.cacheFullSweep(value)
return self.manage_cacheGC(self,REQUEST)
def manage_minimize(self,value,REQUEST):
"Perform a full sweep through the cache"
Globals.Bobobase._jar.cache.minimize(value)
try: db=self._p_jar.db()
except:
# BoboPOS2
Globals.Bobobase._jar.cache.minimize(value)
else: db.cacheMinimize(value)
return self.manage_cacheGC(self,REQUEST)
def initialize_cache(self):
Globals.Bobobase._jar.cache.cache_size=self._cache_size
Globals.Bobobase._jar.cache.cache_age =self._cache_age
try: db=self._p_jar.db()
except:
# BoboPOS2
Globals.Bobobase._jar.cache.cache_size=self._cache_size
Globals.Bobobase._jar.cache.cache_age =self._cache_age
else:
db.SetCacheSize(self._cache_size)
db.SetCacheDeactivateAfter(self._cache_age)
db.SetVersionCacheSize(self._vcache_size)
db.SetVersionCacheDeactivateAfter(self._vcache_age)
def cache_detail(self):
detail={}
for oid, ob in Globals.Bobobase._jar.cache.items():
c="%s.%s" % (ob.__class__.__module__, ob.__class__.__name__)
if detail.has_key(c): detail[c]=detail[c]+1
else: detail[c]=1
detail=detail.items()
try: db=self._p_jar.db()
except:
# BoboPOS2
detail={}
for oid, ob in Globals.Bobobase._jar.cache.items():
if hasattr(ob, '__class__'):
ob=ob.__class__
decor=''
else: decor=' class'
c="%s.%s%s" % (ob.__module__ or '', ob.__name__, decor)
if detail.has_key(c): detail[c]=detail[c]+1
else: detail[c]=1
detail=detail.items()
else:
# ZODB 3
detail=db.cacheDetail()
detail=map(lambda d:
(("%s.%s" % (d[0].__module__, d[0].__name__)), d[1]),
detail.items())
detail.sort()
return detail
def cache_extreme_detail(self):
detail=[]
rc=sys.getrefcount
db=Globals.Bobobase._jar.db
for oid, ob in Globals.Bobobase._jar.cache.items():
id=oid
if hasattr(ob,'__dict__'):
d=ob.__dict__
if d.has_key('id'):
id="%s (%s)" % (oid, d['id'])
elif d.has_key('__name__'):
id="%s (%s)" % (oid, d['__name__'])
detail.append({
'oid': id,
'klass': "%s.%s" % (ob.__class__.__module__,
ob.__class__.__name__),
'rc': rc(ob)-4,
'references': db.objectReferencesIn(oid),
})
return detail
try: db=self._p_jar.db()
except:
# BoboPOS2
detail=[]
rc=sys.getrefcount
db=Globals.Bobobase._jar.db
for oid, ob in Globals.Bobobase._jar.cache.items():
id=oid
if hasattr(ob, '__class__'):
if hasattr(ob,'__dict__'):
d=ob.__dict__
if d.has_key('id'):
id="%s (%s)" % (oid, d['id'])
elif d.has_key('__name__'):
id="%s (%s)" % (oid, d['__name__'])
ob=ob.__class__
decor=''
else: decor=' class'
detail.append({
'oid': id,
'klass': "%s.%s%s" % (ob.__module__, ob.__name__, decor),
'rc': rc(ob)-4,
'references': db.objectReferencesIn(oid),
})
return detail
else:
# ZODB 3
return db.cacheExtremeDetail()
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
"""Commonly used utility functions."""
__version__='$Revision: 1.1 $'[11:-2]
import os, sys
from Common import package_home
try: home=os.environ['SOFTWARE_HOME']
except:
import Products
home=package_home(Products.__dict__)
if not os.path.isabs(home):
home=os.path.join(os.getcwd(), home)
home,e=os.path.split(home)
if os.path.split(home)[1]=='.': home=os.path.split(home)[0]
if os.path.split(home)[1]=='..':
home=os.path.split(os.path.split(home)[0])[0]
sys.modules['__builtin__'].SOFTWARE_HOME=SOFTWARE_HOME=home
try: chome=os.environ['INSTANCE_HOME']
except:
chome=home
d,e=os.path.split(chome)
if e=='python':
d,e=os.path.split(d)
if e=='lib': chome=d or os.getcwd()
sys.modules['__builtin__'].INSTANCE_HOME=INSTANCE_HOME=chome
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
from class_init import default__class_init__
from Persistence import Persistent
import Globals
from DateTime import DateTime
Persistent.__dict__['__class_init__']=default__class_init__
class PersistentUtil:
def bobobase_modification_time(self):
jar=self._p_jar
oid=self._p_oid
if jar is None or oid is None: return DateTime()
try:
t=self._p_mtime
if t is None: return DateTime()
except: t=0
return DateTime(t)
def locked_in_version(self):
"""Was the object modified in any version?
"""
jar=self._p_jar
oid=self._p_oid
if jar is None or oid is None: return None
try: mv=jar.db().modifiedInVersion
except: pass
else: return mv()
# BoboPOS 2 code:
oid=self._p_oid
return (oid
and Globals.VersionBase.locks.has_key(oid)
and Globals.VersionBase.verify_lock(oid))
def modified_in_version(self):
"""Was the object modified in this version?
"""
jar=self._p_jar
oid=self._p_oid
if jar is None or oid is None: return None
try: mv=jar.db().modifiedInVersion
except: pass
else: return mv()==jar.getVersion()
# BoboPOS 2 code:
jar=self._p_jar
if jar is None:
if hasattr(self,'aq_parent') and hasattr(self.aq_parent, '_p_jar'):
jar=self.aq_parent._p_jar
if jar is None: return 0
if not jar.name: return 0
try: jar.db[self._p_oid]
except: return 0
return 1
for k, v in PersistentUtil.__dict__.items(): Persistent.__dict__[k]=v
......@@ -309,7 +309,8 @@ class Product(Folder):
self._objects))
}
f.write(cPickle.dumps(meta,1))
self._p_jar.db.exportoid(self._p_oid, f)
self._p_jar.exportFile(self._p_oid, f)
ar.add(prefix+'product.dat', f.getdata())
ar.finish()
......@@ -430,7 +431,7 @@ def initializeProduct(productp, name, home, app):
try:
f=CompressedInputFile(open(home+'/product.dat','rb'),name+' shshsh')
meta=cPickle.Unpickler(f).load()
product=Globals.Bobobase._jar.import_file(f)
product=app._p_jar.importFile(f)
product._objects=meta['_objects']
except:
f=fver and (" (%s)" % fver)
......
......@@ -85,8 +85,8 @@
__doc__='''short description
$Id: Undo.py,v 1.12 1999/03/25 15:26:53 jim Exp $'''
__version__='$Revision: 1.12 $'[11:-2]
$Id: Undo.py,v 1.13 1999/04/29 19:16:04 jim Exp $'''
__version__='$Revision: 1.13 $'[11:-2]
import Globals, ExtensionClass
from DateTime import DateTime
......@@ -142,52 +142,60 @@ class UndoSupport(ExtensionClass.Base):
first_transaction+PrincipiaUndoBatchSize)
db=self._p_jar.db
r=[]
add=r.append
h=['','']
try:
if Globals.Bobobase.has_key('_pack_time'):
since=Globals.Bobobase['_pack_time']
else: since=0
trans_info=db.transaction_info(
first_transaction,last_transaction,path,since=since)
except: trans_info=[]
for info in trans_info:
while len(info) < 4: info.append('')
[path, user] = (split(info[2],' ')+h)[:2]
t=info[1]
l=find(t,' ')
if l >= 0: t=t[l:]
add(
{'pos': info[0],
'time': DateTime(atof(t)),
'id': info[1],
'identity': info[2],
'user': user,
'path': path,
'desc': info[3],
})
return r or []
r=db().undoLog()
except:
# BoboPOS2
r=[]
add=r.append
h=['','']
try:
if Globals.Bobobase.has_key('_pack_time'):
since=Globals.Bobobase['_pack_time']
else: since=0
trans_info=db.transaction_info(
first_transaction,last_transaction,path,since=since)
except: trans_info=[]
for info in trans_info:
while len(info) < 4: info.append('')
t=info[1]
l=find(t,' ')
if l >= 0: t=t[l:]
add(
{'time': DateTime(atof(t)),
'id': "%s %s" % (info[1], info[0]),
'user_name': info[2],
'description': info[3],
})
else:
# ZODB 3
for d in r: r['time']=DateTime(r['time'])
return r
def manage_undo_transactions(self, transaction_info, REQUEST=None):
"""
"""
info=[]
jar=self._p_jar
db=jar.db
for i in transaction_info:
l=rfind(i,' ')
oids=db.Toops( (i[:l],), atoi(i[l:]))
jar.reload_oids(oids)
try: undo=db().undo
except:
# BoboPOS 2
for i in transaction_info:
l=rfind(i,' ')
oids=db.Toops( (i[:l],), atoi(i[l:]))
jar.reload_oids(oids)
else:
# ZODB 3
for i in transaction_info: undo(i)
if REQUEST is None: return
RESPONSE=REQUEST['RESPONSE']
RESPONSE.setStatus(302)
RESPONSE['Location']="%s/manage_main" % REQUEST['URL1']
REQUEST['RESPONSE'].redirect("%s/manage_main" % REQUEST['URL1'])
return ''
Globals.default__class_init__(UndoSupport)
......@@ -7,35 +7,29 @@
<h2>Cache Parameters and Statistics</h2>
<table>
<tr><th align=right>Total number of objects in the database:</th>
<tr><th align=left>Total number of objects in the database</th>
<td><!--#var database_size--></td></tr>
<tr><th align=right>Number of objects in the cache:</th>
<tr><th align=left>Number of objects in the cache</th>
<td><!--#var cache_length--></td></tr>
<tr><th valign=top align=right>Target size:</th><td>
<tr><th valign=top align=left>Target size</th><td>
<form action="<!--#var URL1-->/manage_cache_size" method=GET>
<input type="text" name="value:int" value="<!--#var cache_size-->" size=6>
<input type="submit" value="Change">
</form></td></tr>
<tr><th align=right>Mean time since last access (minutes):</th>
<td><!--#var cache_mean_age fmt="%.4g"--></td></tr>
<tr><th valign=top align=right>Target maximum time between accesses:</th><td>
<tr><th valign=top align=left>Target maximum time between accesses</th><td>
<form action="<!--#var URL1-->/manage_cache_age" method=GET>
<input type="text" name="value:int" value="<!--#var cache_age-->" size=6>
<input type="submit" value="Change">
</form></td></tr>
<tr><th align=right>Deactivation rate (objects/minute):</th>
<td><!--#var cache_mean_deac fmt="%.4f"--></td></tr>
<tr><th align=right>Deallocation rate (objects/minute):</th>
<td><!--#var cache_mean_deal fmt="%.4f"--></td></tr>
<tr><th align=right>Time of last cache garbage collection:</th>
<td><!--#var cache_last_gc_time--></td></tr>
<!--#in cacheStatistics-->
<tr><th align=left><!--#var sequence-key--></th>
<td><!--#var sequence-item--></td>
</tr>
<!--#/in-->
</table>
......
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
from AccessControl.PermissionRole import PermissionRole
class ApplicationDefaultPermissions:
_View_Permission='Manager', 'Anonymous'
def default__class_init__(self):
dict=self.__dict__
have=dict.has_key
ft=type(default__class_init__)
for name, v in dict.items():
if hasattr(v,'_need__name__') and v._need__name__:
v.__dict__['__name__']=name
if name=='manage' or name[:7]=='manage_':
name=name+'__roles__'
if not have(name): dict[name]='Manager',
elif name=='manage' or name[:7]=='manage_' and type(v) is ft:
name=name+'__roles__'
if not have(name): dict[name]='Manager',
if hasattr(self, '__ac_permissions__'):
for acp in self.__ac_permissions__:
pname, mnames = acp[:2]
pr=PermissionRole(pname)
for mname in mnames:
try: getattr(self, mname).__roles__=pr
except: dict[mname+'__roles__']=pr
pname=pr._p
if not hasattr(ApplicationDefaultPermissions, pname):
if len(acp) > 2:
setattr(ApplicationDefaultPermissions, pname, acp[2])
else:
setattr(ApplicationDefaultPermissions, pname, ('Manager',))
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
import DocumentTemplate, Common, Persistence, MethodObject, Globals, os
from Persistence import Persistent
class HTML(DocumentTemplate.HTML,Persistence.Persistent,):
"Persistent HTML Document Templates"
class HTMLFile(DocumentTemplate.HTMLFile,MethodObject.Method,):
"Persistent HTML Document Templates read from files"
class func_code: pass
func_code=func_code()
func_code.co_varnames='trueself', 'self', 'REQUEST'
func_code.co_argcount=3
_need__name__=1
_v_last_read=0
def __init__(self,name,_prefix=None, **kw):
if _prefix is None: _prefix=SOFTWARE_HOME
elif type(_prefix) is not type(''):
_prefix=Common.package_home(_prefix)
args=(self, '%s/%s.dtml' % (_prefix,name))
if not kw.has_key('__name__'): kw['__name__']=name
apply(HTMLFile.inheritedAttribute('__init__'),args,kw)
def __call__(self, *args, **kw):
if Globals.DevelopmentMode:
__traceback_info__=self.raw
t=os.stat(self.raw)
if t != self._v_last_read:
self.cook()
self._v_last_read=t
return apply(HTMLFile.inheritedAttribute('__call__'),
(self,)+args[1:],kw)
......@@ -35,11 +35,11 @@
<!--#in undoable_transactions mapping-->
<tr>
<td valign=top><input type=checkbox name="transaction_info:list"
value="<!--#var id--> <!--#var pos-->"></td>
value="<!--#var id-->"></td>
<td valign=top>
<strong><!--#var desc--></strong> by <strong>
<!--#if user-->
<strong><!--#if path--><!--#var path-->/<!--#/if--><!--#var user-->
<strong><!--#var description--></strong> by <strong>
<!--#if user_name-->
<!--#var user_name-->
<!--#else-->
<em>Zope</em>
<!--#/if-->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment