def DEL(self, account1, account2, amount, name): Utility.checkAccountNumber(account1) Utility.checkAccountName(name) if account2 != self.Unused['account']: self.fatalAccountNumber('DEL', account2) elif amount != self.Unused['amount']: self.fatalAmount('DEL', amount) else: self.accounts.deleteAccount(account1, name)
def NEW(self, account1, account2, amount, name): Utility.checkAccountNumber(account1) Utility.checkAccountName(name) if account2 != self.Unused['account']: self.fatalAccountNumber('NEW', account2) elif amount != self.Unused['amount']: self.fatalAmount('NEW', amount) acct = self.accounts.getAccountByNumber(account1) if acct is not None: Utility.log('Account number already exists.') else: self.accounts.addAccount(account1, name)
def __init__(self, oldMasterFile, newMasterFile, accountsFile): lines = FileIO.readLines(oldMasterFile) if len(lines) < 1: Utility.fatal('Empty Master Accounts File') self.newMasterFile = newMasterFile self.accountsFile = accountsFile self.list = [] count = 0 for line in lines: line = line.strip("\r\n ") params = line.split(' ') if (len(params) != 3): Utility.fatal("Line " + str(count) + " is invalid - parameter count != 3") Utility.checkAccountNumber(params[0]) Utility.checkAmount(params[1]) Utility.checkAccountName(params[2]) self.list.append(Account(int(params[0]), int(params[1]), params[2]))