You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
There is a problem with deferred validators and missing. For example schema
class CrosspaymentSchema(ResourceSchema):
date = colander.SchemaNode(
Date(),
)
account_from_id = colander.SchemaNode(
colander.Integer(),
missing=None,
validator=account_from_validator
)
subaccount_from_id = colander.SchemaNode(
colander.Integer(),
missing=None,
)
and validator
class AccountFromValidator(object):
def __init__(self, request):
self.request = request
def __call__(self, node, value):
request = self.request
subaccount_from_id = cast_int(request.params.get('subaccount_from_id'))
if not value and not subaccount_from_id:
raise colander.Invalid(
node,
_(u'Set at least one account or subaccount from any section'),
)
if value and subaccount_from_id:
raise colander.Invalid(
node,
_(u'Set only account or subaccount or clear both')
)
@colander.deferred
def account_from_validator(node, kw):
request = kw.get('request')
return colander.All(AccountFromValidator(request))
I expect to get 'Set at least one account or subaccount from any section' error if both account_from_id and subaccount_from_id is empty. But I have not validation errors.
The text was updated successfully, but these errors were encountered:
Hi
There is a problem with deferred validators and missing. For example schema
and validator
I expect to get 'Set at least one account or subaccount from any section' error if both account_from_id and subaccount_from_id is empty. But I have not validation errors.
The text was updated successfully, but these errors were encountered: