import string
-from UserList import UserList
# Flad restriction error
def_keysep = ": "
-class Flad(UserList):
+class Flad(list):
"""
Class to represent memory database.
FLAD database is a list of records,
# field_sep = rec_sep = '\n'
def __init__(self, check_record_func = None, key_sep = def_keysep):
- UserList.__init__(self)
+ list.__init__(self)
self.check_record_func = check_record_func
self.key_sep = key_sep
if not self.check_record(item):
self.checking_error()
else:
- UserList.__setitem__(self, i, item)
+ list.__setitem__(self, i, item)
- def __setslice__(self, i, j, list):
- if list:
- copy_list = list[:]
- for item in list:
+ def __setslice__(self, i, j, v_list):
+ if v_list:
+ copy_list = v_list[:]
+ for item in v_list:
if not self.check_record(item):
self.checking_error()
del copy_list[copy_list.index(item)]
- UserList.__setslice__(self, i, j, copy_list)
+ list.__setslice__(self, i, j, copy_list)
def append(self, item):
if not self.check_record(item):
self.checking_error()
else:
- UserList.append(self, item)
+ list.append(self, item)
def insert(self, i, item):
if not self.check_record(item):
self.checking_error()
else:
- UserList.insert(self, i, item)
+ list.insert(self, i, item)
def split_key(self, line):