def __declare_last__(cls): ValidateInteger(Transaction.ccy_id, False, True) ValidateNumeric(Transaction.amount, False, True) ValidateInteger(Transaction.payer_id, False, True) ValidateInteger(Transaction.recvr_id, False, True) ValidateInteger(Transaction.requestor_id, False, True) ValidateInteger(Transaction.approver_id, False, True)
def define_validators(self): """ Define Validators """ ValidateInteger(self.DummyModel.integer) ValidateLessThan(self.DummyModel.integer, 100000) ValidateLessThanOrEqual(self.DummyModel.integer, 99999) ValidateInteger(self.DummyModel.int_exception, True, True) ValidateString(self.DummyModel.str_exception, True, True, "Test Message") ValidateNumeric(self.DummyModel.numeric) ValidateString(self.DummyModel.string) ValidateBoolean(self.DummyModel.boolean) ValidateLength(self.DummyModel.string, 10, 2) ValidateEmail(self.DummyModel.email) ValidateRegex(self.DummyModel.regex, "[A-Z][a-z]+") ValidateIP(self.DummyModel.ip) ValidateIP(self.DummyModel.ipv6, True) ValidateURL(self.DummyModel.url) ValidateUUID(self.DummyModel.uuid) ValidateCountry(self.DummyModel.country) ValidateTimezone(self.DummyModel.timezone) ValidateLocale(self.DummyModel.locale) ValidateGreaterThan(self.DummyModel.large, 100) ValidateGreaterThanOrEqual(self.DummyModel.large, 101) ValidateCreditCard(self.DummyModel.creditcard) ValidateCurrency(self.DummyModel.currency) ValidateIBAN(self.DummyModel.iban) ValidateISBN(self.DummyModel.isbn) ValidateString(self.DummyModel.null, True) self.rangevalues = [11, 12, 13] ValidateRange(self.DummyModel.rangefield, self.rangevalues)
def __declare_last__(cls): for col in cls.__table__.columns: type = col.type.python_type if type == str: ValidateString(getattr(cls, col.name), allow_null=col.nullable, throw_exception=True) if col.type.length: ValidateLength(getattr(cls, col.name), col.type.length, throw_exception=True, message=f'Max length is { col.type.length}') elif type == int: ValidateInteger(getattr(cls, col.name), allow_null=col.nullable, throw_exception=True) elif type == float: ValidateNumeric(getattr(cls, col.name), allow_null=col.nullable, throw_exception=True) elif type == date: ValidateDate(getattr(cls, col.name), allow_null=col.nullable, throw_exception=True) elif type == datetime: ValidateDateTime(getattr(cls, col.name), allow_null=col.nullable, throw_exception=True) BaseModel.validators()
def __declare_last__(cls): ValidateString(Account.name, False, True) ValidateInteger(Account.ccy_id, False, True)
def __declare_last__(cls): ValidateNumeric(StripePlan.amount, False, True) ValidateString(StripePlan.name, False, True) ValidateInteger(StripePlan.ccy_id, False, True) ValidateString(StripePlan.interval, False, True)
def __declare_last__(cls): ValidateInteger(User.integer) ValidateString(User.string, False, True, "Custom Message, " "Field {field} - Value {value} - Oldvalue {oldvalue} - Key {key}")
def __declare_last__(cls): ValidateString(Project.name, False, True) ValidateInteger(Project.account_id, False, True) ValidateNumeric(Project.goal, False, True)
def __declare_last__(cls): ValidateInteger(ResponseHistory.uid) ValidateString(ResponseHistory.response)
def __declare_last__(cls): ValidateInteger(Satellite.platform_id) ValidateString(Satellite.platform_name)
def __declare_last__(cls): ValidateInteger(OrbitRecord.uid)
def __declare_last__(cls): ValidateInteger(OrbitSegment.segment_id) ValidateInteger(OrbitSegment.platform_id)