Пример #1
0
def validate_payment(payment_type, account_id, check_no):
  valid = True
  valid &= vu.validate_integer(payment_type, flash_errors=False) and \
      PaymentType.has_value(int(payment_type))
  valid &= vu.validate_integer(account_id, flash_errors=False)
  if payment_type == PaymentType.CHECK:
    valid &= vu.validate_integer(check_no, flash_errors=False)

  return valid
Пример #2
0
def validate_payment(payment_type, account_id, check_no):
  valid = True
  valid &= vu.validate_integer(payment_type, flash_errors=False) and \
      PaymentType.has_value(int(payment_type))
  valid &= vu.validate_integer(account_id, flash_errors=False)
  if payment_type == PaymentType.CHECK:
    valid &= vu.validate_integer(check_no, flash_errors=False)

  return valid
Пример #3
0
def validate_expense(budget_id, date_incurred, amount, description):
  valid = True
  valid &= vu.validate_integer(budget_id, flash_errors=False)
  valid &= vu.validate_date(date_incurred, flash_errors=False)
  valid &= vu.validate_currency(amount, flash_errors=False)
  valid &= len(description) > 0

  return valid
Пример #4
0
def validate_expense(budget_id, date_incurred, amount, description):
  valid = True
  valid &= vu.validate_integer(budget_id, flash_errors=False)
  valid &= vu.validate_date(date_incurred, flash_errors=False)
  valid &= vu.validate_currency(amount, flash_errors=False)
  valid &= len(description) > 0

  return valid
Пример #5
0
def validate_payee(payee_id, payee_name):
  # TODO also check that the new payee isn't actually an old one...
  # This one's a bit unusual, we want a valid old payee XOR a valid new one
  existing_payee = vu.validate_integer(payee_id, flash_errors=False)
  new_payee = len(payee_name) > 0
  return (existing_payee != new_payee)
Пример #6
0
def validate_payee(payee_id, payee_name):
  # TODO also check that the new payee isn't actually an old one...
  # This one's a bit unusual, we want a valid old payee XOR a valid new one
  existing_payee = vu.validate_integer(payee_id, flash_errors=False)
  new_payee = len(payee_name) > 0
  return (existing_payee != new_payee)