vmspdata ($Date: 2001/04/28 01:23:54 $)
index
vmspdata.py

vmspdata.py - a generalized class for VMSP data manipulation.
 
You'll want to override some methods in this class for your own VMSP
implementation. This class does not yet handle data requests.
 
Copyright (C) Sean Dwyer 2001 under GPL.

 
Modules
            
string
sys

 
Classes
            
VMSPData

 
class VMSPData
      generalized class for data
 
  
__init__(self)
 initialize VMSP data class
_logi(self, msg, type='Info', logfile=None)
utility error/info logging.
 
This is an internal logging function.
Default is to stderr, but a logfile may be used.
dat_alist(self, datfile)
convenience function
dat_clist(self, datfile)
convenience function
dat_get(self, item)
Request an item from the data file.
 
This function alters the datafile, and writes
the result back to it, effectively with admin
privileges.
 
The success of the query is denoted by the variables
got and nitem.
if item exists and is gotten : got = 1, nitem = 1
if item doesnt exist         : got = 0, nitem = 0
if item exits, but NOT gotten: got = 0, nitem = 1
The data file is not altered except when got=1 and
nitem=1
dat_list(self, ilist, type='admin', bank=None)
list a data file dependent on access level.
 
type should be either client or admin.
bank is an optional argument, only required if
     admin access is desired.
 
Returns the listed data, dependent on admin or
normal client access.
dat_rfile(self, filename)
default datafile read method
You should override this method if your datafile
is structured differently.
 
If file reading fails, return an error message.
Otherwise return the bank and the items list.
dat_wfile(self, bank, ilist, amount, item, name)
update the data file with new (if any) data
This method must also be overridden if your
data file is differently structured.
 
This requires the changed items from interaction
with the client. It should not be necessary to call
this method if no changes have been made!
 
Returns error message if fails, otherwise writes the file.
log_rfile(self, filename, function)
general log read menthod.
 
You must supply a function to act on tlist.

 
Data
             __author__ = 'Sean Dwyer <ewe2@can.org.au>'
__date__ = '$Date: 2001/04/28 01:23:54 $'
__file__ = './vmspdata.py'
__name__ = 'vmspdata'
__revision__ = '$Revision: 1.8 $'
datfile = 'pv.dat'
emarker = '#end'
logfile = 'pv.log'
slogfile = 'vmsp.log'
spaces = ' '

 
Author
             Sean Dwyer <ewe2@can.org.au>