Commit 0f45bcc2 authored by Michel Pelletier's avatar Michel Pelletier

Changed Session to Version

parent 78649564
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
# #
############################################################################## ##############################################################################
__doc__="""System management components""" __doc__="""System management components"""
__version__='$Revision: 1.41 $'[11:-2] __version__='$Revision: 1.42 $'[11:-2]
import sys,os,time,string,Globals, Acquisition import sys,os,time,string,Globals, Acquisition
...@@ -96,7 +96,7 @@ from App.Dialogs import MessageDialog ...@@ -96,7 +96,7 @@ from App.Dialogs import MessageDialog
from Product import ProductFolder from Product import ProductFolder
class Fake: class Fake:
def locked_in_session(self): return 0 def locked_in_version(self): return 0
class DatabaseManager(Fake, SimpleItem.Item, Acquisition.Implicit): class DatabaseManager(Fake, SimpleItem.Item, Acquisition.Implicit):
"""Database management""" """Database management"""
...@@ -217,7 +217,7 @@ class ApplicationManager(Folder,CacheManager): ...@@ -217,7 +217,7 @@ class ApplicationManager(Folder,CacheManager):
db=Globals.Bobobase._jar.db db=Globals.Bobobase._jar.db
db.save_index() db.save_index()
db.file.close() db.file.close()
db=Globals.SessionBase.TDB db=Globals.VersionBase.TDB
db.save_index() db.save_index()
db.file.close() db.file.close()
sys.exit(0) sys.exit(0)
...@@ -225,9 +225,9 @@ class ApplicationManager(Folder,CacheManager): ...@@ -225,9 +225,9 @@ class ApplicationManager(Folder,CacheManager):
def manage_pack(self, days=0, REQUEST=None): def manage_pack(self, days=0, REQUEST=None):
"""Pack the database""" """Pack the database"""
if self._p_jar.db is not Globals.Bobobase._jar.db: if self._p_jar.db is not Globals.Bobobase._jar.db:
raise 'Session Error', ( raise 'Version Error', (
'''You may not pack the application database while '''You may not pack the application database while
working in a <em>session</em>''') working in a <em>version</em>''')
t=time.time()-days*86400 t=time.time()-days*86400
if Globals.Bobobase.has_key('_pack_time'): if Globals.Bobobase.has_key('_pack_time'):
since=Globals.Bobobase['_pack_time'] since=Globals.Bobobase['_pack_time']
......
...@@ -85,8 +85,8 @@ ...@@ -85,8 +85,8 @@
__doc__='''Cache management support __doc__='''Cache management support
$Id: CacheManager.py,v 1.11 1999/03/10 00:14:55 klm Exp $''' $Id: CacheManager.py,v 1.12 1999/03/22 18:13:41 michel Exp $'''
__version__='$Revision: 1.11 $'[11:-2] __version__='$Revision: 1.12 $'[11:-2]
import Globals, time, sys import Globals, time, sys
...@@ -107,9 +107,9 @@ class CacheManager: ...@@ -107,9 +107,9 @@ class CacheManager:
def manage_cache_age(self,value,REQUEST): def manage_cache_age(self,value,REQUEST):
"set cache age" "set cache age"
if self._p_jar.db is not Globals.Bobobase._jar.db: if self._p_jar.db is not Globals.Bobobase._jar.db:
raise 'Session Error', ( raise 'Version Error', (
'''You may not change the database cache age '''You may not change the database cache age
while working in a <em>session</em>''') while working in a <em>version</em>''')
self._cache_age=Globals.Bobobase._jar.cache.cache_age=value self._cache_age=Globals.Bobobase._jar.cache.cache_age=value
return self.manage_CacheParameters(self,REQUEST) return self.manage_CacheParameters(self,REQUEST)
...@@ -117,9 +117,9 @@ class CacheManager: ...@@ -117,9 +117,9 @@ class CacheManager:
def manage_cache_size(self,value,REQUEST): def manage_cache_size(self,value,REQUEST):
"set cache size" "set cache size"
if self._p_jar.db is not Globals.Bobobase._jar.db: if self._p_jar.db is not Globals.Bobobase._jar.db:
raise 'Session Error', ( raise 'Version Error', (
'''You may not change the database cache size '''You may not change the database cache size
while working in a <em>session</em>''') while working in a <em>version</em>''')
self._cache_size=Globals.Bobobase._jar.cache.cache_size=value self._cache_size=Globals.Bobobase._jar.cache.cache_size=value
return self.manage_cacheParameters(self,REQUEST) return self.manage_cacheParameters(self,REQUEST)
......
...@@ -17,9 +17,9 @@ the <em>Zope</em> process. <em>Zope</em> be restarted on the next web request. ...@@ -17,9 +17,9 @@ the <em>Zope</em> process. <em>Zope</em> be restarted on the next web request.
<BR><INPUT TYPE="SUBMIT" VALUE="Shutdown"> <BR><INPUT TYPE="SUBMIT" VALUE="Shutdown">
</FORM> </FORM>
<!--#if Principia-Session--> <!--#if Principia-Version-->
<EM>You are currently working in session <!--#var Principia-Session--></EM> <EM>You are currently working in version <!--#var Principia-Version--></EM>
<!--#/if Principia-Session--> <!--#/if Principia-Version-->
<P> <P>
<TABLE> <TABLE>
...@@ -35,13 +35,13 @@ the <em>Zope</em> process. <em>Zope</em> be restarted on the next web request. ...@@ -35,13 +35,13 @@ the <em>Zope</em> process. <em>Zope</em> be restarted on the next web request.
<A HREF="<!--#var sequence-key-->/manage_workspace"> <A HREF="<!--#var sequence-key-->/manage_workspace">
<!--#var title--> <!--#var title-->
</A> </A>
<!--#if locked_in_session--> <!--#if locked_in_version-->
<!--#if modified_in_session--> <!--#if modified_in_version-->
<IMG SRC="<!--#var SCRIPT_NAME-->/p_/locked" <IMG SRC="<!--#var SCRIPT_NAME-->/p_/locked"
ALT="This item has been modified in this session"> ALT="This item has been modified in this version">
<!--#else--> <!--#else-->
<IMG SRC="<!--#var SCRIPT_NAME-->/p_/lockedo" <IMG SRC="<!--#var SCRIPT_NAME-->/p_/lockedo"
ALT="This item has been modified in another session"> ALT="This item has been modified in another version">
<!--#/if--> <!--#/if-->
<!--#/if--> <!--#/if-->
</TD> </TD>
......
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
"""Global definitions""" """Global definitions"""
__version__='$Revision: 1.36 $'[11:-2] __version__='$Revision: 1.37 $'[11:-2]
import sys, os import sys, os
from DateTime import DateTime from DateTime import DateTime
...@@ -177,12 +177,12 @@ class PersistentUtil: ...@@ -177,12 +177,12 @@ class PersistentUtil:
except: t=0 except: t=0
return DateTime(t) return DateTime(t)
def locked_in_session(self): def locked_in_version(self):
oid=self._p_oid oid=self._p_oid
return (oid and SessionBase.locks.has_key(oid) return (oid and VersionBase.locks.has_key(oid)
and SessionBase.verify_lock(oid)) and VersionBase.verify_lock(oid))
def modified_in_session(self): def modified_in_version(self):
jar=self._p_jar jar=self._p_jar
if jar is None: if jar is None:
if hasattr(self,'aq_parent') and hasattr(self.aq_parent, '_p_jar'): if hasattr(self,'aq_parent') and hasattr(self.aq_parent, '_p_jar'):
...@@ -235,7 +235,7 @@ BobobaseName = '%s/Data.bbb' % data_dir ...@@ -235,7 +235,7 @@ BobobaseName = '%s/Data.bbb' % data_dir
from App.Dialogs import MessageDialog from App.Dialogs import MessageDialog
SessionNameName='Principia-Session' VersionNameName='Principia-Version'
# utility stuff # utility stuff
......
...@@ -101,20 +101,20 @@ BoboPOS.PickleJar.PickleJar.Broken=OFS.Uninstalled.Broken ...@@ -101,20 +101,20 @@ BoboPOS.PickleJar.PickleJar.Broken=OFS.Uninstalled.Broken
# Open the application database # Open the application database
Bobobase=OFS.Application.open_bobobase() Bobobase=OFS.Application.open_bobobase()
SessionBase=Globals.SessionBase=TJar.TM(Bobobase) VersionBase=Globals.VersionBase=TJar.TM(Bobobase)
if os.environ.has_key('ZOPE_DATABASE_QUOTA'): if os.environ.has_key('ZOPE_DATABASE_QUOTA'):
quota=string.atoi(os.environ['ZOPE_DATABASE_QUOTA']) quota=string.atoi(os.environ['ZOPE_DATABASE_QUOTA'])
Bobobase._jar.db.set_quota( Bobobase._jar.db.set_quota(
lambda x, quota=quota, otherdb=SessionBase.TDB: lambda x, quota=quota, otherdb=VersionBase.TDB:
x + otherdb.pos > quota) x + otherdb.pos > quota)
SessionBase.TDB.set_quota( VersionBase.TDB.set_quota(
lambda x, quota=quota, otherdb=Bobobase._jar.db: lambda x, quota=quota, otherdb=Bobobase._jar.db:
x + otherdb.pos > quota) x + otherdb.pos > quota)
SingleThreadedTransaction.Transaction.commit=SessionBase.committer() SingleThreadedTransaction.Transaction.commit=VersionBase.committer()
bobo_application=app=Bobobase['Application'] bobo_application=app=Bobobase['Application']
......
...@@ -85,8 +85,8 @@ ...@@ -85,8 +85,8 @@
__doc__='''Application support __doc__='''Application support
$Id: Application.py,v 1.91 1999/03/22 17:30:08 jim Exp $''' $Id: Application.py,v 1.92 1999/03/22 18:13:42 michel Exp $'''
__version__='$Revision: 1.91 $'[11:-2] __version__='$Revision: 1.92 $'[11:-2]
import Globals,Folder,os,regex,sys,App.Product, App.ProductRegistry import Globals,Folder,os,regex,sys,App.Product, App.ProductRegistry
...@@ -257,8 +257,8 @@ class Application(Globals.ApplicationDefaultPermissions, Folder.Folder, ...@@ -257,8 +257,8 @@ class Application(Globals.ApplicationDefaultPermissions, Folder.Folder,
Redirect=ZopeRedirect=PrincipiaRedirect Redirect=ZopeRedirect=PrincipiaRedirect
def __bobo_traverse__(self, REQUEST, name=None): def __bobo_traverse__(self, REQUEST, name=None):
if name is None and REQUEST.has_key(Globals.SessionNameName): if name is None and REQUEST.has_key(Globals.VersionNameName):
pd=Globals.SessionBase[REQUEST[Globals.SessionNameName]] pd=Globals.VersionBase[REQUEST[Globals.VersionNameName]]
alternate_self=pd.jar[self._p_oid] alternate_self=pd.jar[self._p_oid]
if hasattr(self, 'aq_parent'): if hasattr(self, 'aq_parent'):
alternate_self=alternate_self.__of__(self.aq_parent) alternate_self=alternate_self.__of__(self.aq_parent)
......
...@@ -86,11 +86,11 @@ ...@@ -86,11 +86,11 @@
An object moniker is an intelligent reference to a An object moniker is an intelligent reference to a
persistent object. A moniker can be turned back into persistent object. A moniker can be turned back into
a real object that retains its correct session context a real object that retains its correct version context
and aquisition relationships via a simple interface. and aquisition relationships via a simple interface.
""" """
__version__='$Revision: 1.9 $'[11:-2] __version__='$Revision: 1.10 $'[11:-2]
import Globals import Globals
...@@ -98,7 +98,7 @@ import Globals ...@@ -98,7 +98,7 @@ import Globals
class Moniker: class Moniker:
"""An object moniker is an intelligent reference to a """An object moniker is an intelligent reference to a
persistent object. A moniker can be turned back into persistent object. A moniker can be turned back into
a real object that retains its correct session context a real object that retains its correct version context
and aquisition relationships via a simple interface.""" and aquisition relationships via a simple interface."""
def __init__(self, ob=None): def __init__(self, ob=None):
...@@ -123,7 +123,7 @@ class Moniker: ...@@ -123,7 +123,7 @@ class Moniker:
def bind(self): def bind(self):
"Return the real object named by this moniker" "Return the real object named by this moniker"
if self.jar is None: jar=Globals.Bobobase._jar if self.jar is None: jar=Globals.Bobobase._jar
else: jar=Globals.SessionBase[self.jar].jar else: jar=Globals.VersionBase[self.jar].jar
ob=None ob=None
for n in self.ids: for n in self.ids:
o=jar[n] o=jar[n]
......
...@@ -25,13 +25,13 @@ ...@@ -25,13 +25,13 @@
<A HREF="<!--#var sequence-key url_quote-->/manage_workspace"> <A HREF="<!--#var sequence-key url_quote-->/manage_workspace">
<!--#var sequence-key--> <!--#if title-->(<!--#var title-->)<!--#/if--> <!--#var sequence-key--> <!--#if title-->(<!--#var title-->)<!--#/if-->
</A> </A>
<!--#if locked_in_session--> <!--#if locked_in_version-->
<!--#if modified_in_session--> <!--#if modified_in_version-->
<IMG SRC="<!--#var SCRIPT_NAME-->/p_/locked" <IMG SRC="<!--#var SCRIPT_NAME-->/p_/locked"
ALT="This item has been modified in this session"> ALT="This item has been modified in this version">
<!--#else--> <!--#else-->
<IMG SRC="<!--#var SCRIPT_NAME-->/p_/lockedo" <IMG SRC="<!--#var SCRIPT_NAME-->/p_/lockedo"
ALT="This item has been modified in another session"> ALT="This item has been modified in another version">
<!--#/if--> <!--#/if-->
<!--#/if--> <!--#/if-->
</TD> </TD>
......
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
<body bgcolor="#FFFFFF" link="#000099" vlink="#555555"> <body bgcolor="#FFFFFF" link="#000099" vlink="#555555">
<!--#var manage_tabs--> <!--#var manage_tabs-->
<!--#if Principia-Session--> <!--#if Principia-Version-->
<p> <p>
<em>You are currently working in session <!--#var Principia-Session--></em> <em>You are currently working in version <!--#var Principia-Version--></em>
</p> </p>
<!--#/if Principia-Session--> <!--#/if Principia-Version-->
<form action="." method="POST"> <form action="." method="POST">
<!--#if propertyMap--> <!--#if propertyMap-->
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555"> <BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<!--#var manage_tabs--> <!--#var manage_tabs-->
<P> <P>
<!--#if Principia-Session--> <!--#if Principia-Version-->
<EM>You are currently working in session <!--#var Principia-Session--></EM> <EM>You are currently working in version <!--#var Principia-Version--></EM>
<P> <P>
<!--#/if Principia-Session--> <!--#/if Principia-Version-->
<FORM ACTION="." METHOD="POST"> <FORM ACTION="." METHOD="POST">
<!--#if objectItems--> <!--#if objectItems-->
...@@ -33,13 +33,13 @@ ...@@ -33,13 +33,13 @@
<!--#/if--> <!--#/if-->
<!--#if title-->(<!--#var title-->)<!--#/if--> <!--#if title-->(<!--#var title-->)<!--#/if-->
</A> </A>
<!--#if locked_in_session--> <!--#if locked_in_version-->
<!--#if modified_in_session--> <!--#if modified_in_version-->
<IMG SRC="<!--#var SCRIPT_NAME-->/p_/locked" <IMG SRC="<!--#var SCRIPT_NAME-->/p_/locked"
ALT="This item has been modified in this session"> ALT="This item has been modified in this version">
<!--#else--> <!--#else-->
<IMG SRC="<!--#var SCRIPT_NAME-->/p_/lockedo" <IMG SRC="<!--#var SCRIPT_NAME-->/p_/lockedo"
ALT="This item has been modified in another session"> ALT="This item has been modified in another version">
<!--#/if--> <!--#/if-->
<!--#/if--> <!--#/if-->
</TD> </TD>
......
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