Closed RaphaelBonaque closed 5 years ago
I tried using a field to represent an ip as follows, on python3
ip_address = Field('string', validation={'is': 'ip'})
However I get two validation problems at insert time:
the isIP validator tries to instantiate an isIPv4 validator with the argument automatic: https://github.com/gi0baro/weppy/blob/9861a0eee8984ae0a6208cdbd256e2fd6b771f13/weppy/validators/consist.py#L813-L819 This argument is not declared on the constructor of isIPv4 but an unused argument named auto does exist https://github.com/gi0baro/weppy/blob/9861a0eee8984ae0a6208cdbd256e2fd6b771f13/weppy/validators/consist.py#L615-L616
automatic
auto
a piece of code tries to find the length of a filter object at https://github.com/gi0baro/weppy/blob/9861a0eee8984ae0a6208cdbd256e2fd6b771f13/weppy/validators/consist.py#L623-L624
I tried the following:
== len(filter( lambda item: isinstance(item, int), value)) ==
== len(list(filter( lambda item: isinstance(item, int), value))) ==
== sum(isinstance(item, int) for item in value) ==
This worked for my particular case but I don't know if this is a general solution.
I started using weppy this afternoon so I might be missing something.
@RaphaelBonaque thank you, will fix this in the next release
I tried using a field to represent an ip as follows, on python3
However I get two validation problems at insert time:
the isIP validator tries to instantiate an isIPv4 validator with the argument
automatic
: https://github.com/gi0baro/weppy/blob/9861a0eee8984ae0a6208cdbd256e2fd6b771f13/weppy/validators/consist.py#L813-L819 This argument is not declared on the constructor of isIPv4 but an unused argument namedauto
does exist https://github.com/gi0baro/weppy/blob/9861a0eee8984ae0a6208cdbd256e2fd6b771f13/weppy/validators/consist.py#L615-L616a piece of code tries to find the length of a filter object at https://github.com/gi0baro/weppy/blob/9861a0eee8984ae0a6208cdbd256e2fd6b771f13/weppy/validators/consist.py#L623-L624
I tried the following:
automatic
toauto
at https://github.com/gi0baro/weppy/blob/9861a0eee8984ae0a6208cdbd256e2fd6b771f13/weppy/validators/consist.py#L819== len(filter( lambda item: isinstance(item, int), value)) ==
to== len(list(filter( lambda item: isinstance(item, int), value))) ==
( or to== sum(isinstance(item, int) for item in value) ==
)This worked for my particular case but I don't know if this is a general solution.
I started using weppy this afternoon so I might be missing something.