def __loadFromFile(self): try: f = open(self.__fName, "r") line = f.readline().strip() while line != "": attributes = line.split(";") book = Rental(attributes[0], attributes[1], attributes[2], attributes[3], attributes[4], attributes[5]) RepoRental.addElement(self, book, 0) line = f.readline().strip() except IOError: raise RepoFileError() finally: f.close()
def addElement(self, element, param): RepoRental.addElement(self, element, param) self.__addElementToFile()