Commit 178e6a6b authored by Jim Fulton's avatar Jim Fulton

Got rid of db method and added session support and checks.

parent dde33842
__doc__="""Application management component"""
__version__='$Revision: 1.10 $'[11:-2]
__version__='$Revision: 1.11 $'[11:-2]
import sys,os,time,Globals
......@@ -45,7 +45,7 @@ class ApplicationManager(Acquirer,Management,CacheManager):
d=d and ('%s day%s' % (d,(d!=1 and 's' or ''))) or ''
return '%s %02d:%02d' % (d,h,m)
def db_name(self): return Globals.BobobaseName
def db_name(self): return self._p_jar.db.file_name
def db_size(self):
s=os.stat(self.db_name())[6]
......@@ -57,10 +57,17 @@ class ApplicationManager(Acquirer,Management,CacheManager):
db=Globals.Bobobase._jar.db
db.save_index()
db.file.close()
db=Globals.SessionBase.TDB
db.save_index()
db.file.close()
sys.exit(0)
def manage_pack(self, days=0, REQUEST):
"""Pack the database"""
if self._p_jar.db is not Globals.Bobobase:
raise 'Session Error', (
'''You may not pack the application database while
working in a <em>session</em>''')
Globals.Bobobase._jar.db.pack(time.time()-days*86400,1)
return self.manage_main(self, REQUEST)
......@@ -69,6 +76,6 @@ class ApplicationManager(Acquirer,Management,CacheManager):
def manage_addProduct(self, product):
"""Register a product
"""
products=Globals.Bobobase['products']
products=self._p_jar.db['products']
if product not in products:
Globals.Bobobase['products']=tuple(products)+(product,)
self._p_jar.db['products']=tuple(products)+(product,)
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