def __init__(self, account, type_, value, payment_value): WorkItem.__init__(self) self.bill_list = [ 'House bill', 'Eletricity bill', 'Water bill', 'Credit card bill' ] self.value = value self.datetime = datetime.now() self.payment_value = 0 if type_ in self.bill_list: self.type_ = type_ else: raise AssociationError('A Bill is expected , instead %s passed' % (type_)) if not value == payment_value: raise AssociationError( 'Equal value is expected for the payment, Value payment is %s , payment value is %s' % (value, payment_value)) if not RuleManager.get_instance().check_rule( 'should_be_instance_of_bank_account', account): raise AssociationError( 'Bank Account instance expected, instead %s passed' % type(account)) self.account = account self.account.average_credit -= int(self.value) self.account.save_base()
def __init__(self, loan_request): WorkItem.__init__(self) try: self.rule_should_be_loan_request_instance(loan_request) except: raise AssociationError('Loan Request instance expected, instead %s passed' % type(loan_request)) self.loan_request = loan_request self.datetime = datetime.now()
def __init__(self, loan_request): WorkItem.__init__(self) if not RuleManager.get_instance().check_rule('should_be_instance_of_loan_request', loan_request): raise AssociationError('Loan Request instance expected, instead %s passed' % type(loan_request)) self.loan_request = loan_request self.value = self.loan_request.value self.account = self.loan_request.account self.account.average_credit += float(self.value) self.datetime = datetime.now() self.account.save_base()
def __init__(self, loan_request): WorkItem.__init__(self) try: self.rule_should_be_loan_request_instance(loan_request) except: raise AssociationError( 'Loan Request instance expected, instead %s passed' % type(loan_request)) self.loan_request = loan_request self.datetime = datetime.now()
def __init__(self, account, value, analyst): WorkItem.__init__(self) self.value = value self.approved = False self.datetime = datetime.now() if not RuleManager.get_instance().check_rule('should_be_instance_of_bank_account', account): raise AssociationError('Bank Account instance expected, instead %s passed' % type(account)) self.account = account if not RuleManager.get_instance().check_rule('should_be_instance_of_credit_analyst', analyst): raise AssociationError('Credit Analyst instance expected, instead %s passed' % type(analyst)) self.analyst = analyst
def __init__(self, account, value, analyst): WorkItem.__init__(self) self.value = value self.approved = False self.datetime = datetime.now() self.analyst = analyst try: #self.rule_should_be_credit_analyst_instance(analyst) --> circular reference, how to solve? self.rule_should_be_bank_account_instance(account) except: raise AssociationError('Bank Account instance expected, instead %s passed' % type(account)) else: self.account = account
def __init__(self, account, value, analyst): WorkItem.__init__(self) self.value = value self.approved = False self.datetime = datetime.now() self.analyst = analyst try: #self.rule_should_be_credit_analyst_instance(analyst) --> circular reference, how to solve? self.rule_should_be_bank_account_instance(account) except: raise AssociationError( 'Bank Account instance expected, instead %s passed' % type(account)) else: self.account = account
def __init__(self, account, type_, value, payment_value): WorkItem.__init__(self) self.bill_list = ['House bill', 'Eletricity bill', 'Water bill', 'Credit card bill'] self.value = value self.datetime = datetime.now() self.payment_value = 0 if type_ in self.bill_list: self.type_ = type_ else: raise AssociationError('A Bill is expected , instead %s passed'%(type_)) if not value == payment_value: raise AssociationError('Equal value is expected for the payment, Value payment is %s , payment value is %s' % (value,payment_value)) if not RuleManager.get_instance().check_rule('should_be_instance_of_bank_account', account): raise AssociationError('Bank Account instance expected, instead %s passed' % type(account)) self.account = account self.account.average_credit -= int(self.value) self.account.save_base()
def __init__(self, loan_request): WorkItem.__init__(self) if not RuleManager.get_instance().check_rule('should_be_instance_of_loan_request', loan_request): raise AssociationError('Loan Request instance expected, instead %s passed' % type(loan_request)) self.loan_request = loan_request self.datetime = datetime.now()