[web2py] Re: login_bare custom validation

2015-10-07 Thread 'DenesL' via web2py-users
Thanks Massimo I never really went away ;-) On Wednesday, October 7, 2015 at 2:06:16 PM UTC-4, Massimo Di Pierro wrote: > > welcome back Denes. :-) > your fix is in trunk. > > > On Monday, 5 October 2015 15:33:48 UTC-5, DenesL wrote: >> >> This seems to work: >> >> def __call__(self,

[web2py] Re: login_bare custom validation

2015-10-07 Thread Massimo Di Pierro
welcome back Denes. :-) your fix is in trunk. On Monday, 5 October 2015 15:33:48 UTC-5, DenesL wrote: > > This seems to work: > > def __call__(self, value): > v = str(value) > v = v and v[:self.max_length] > if len(v) < self.min_length: > return ('',

[web2py] Re: login_bare custom validation

2015-10-05 Thread 'DenesL' via web2py-users
Tracing the execution it shows that the password is converted to a LazyCrypt object and then validated using the field's requires which uses Crypt.__call__ where this line value = value and value[:self.max_length] triggers a __getitem__ exception, since it is not defined in class LazyCrypt.

[web2py] Re: login_bare custom validation

2015-10-05 Thread 'DenesL' via web2py-users
This seems to work: def __call__(self, value): v = str(value) v = v and v[:self.max_length] if len(v) < self.min_length: return ('', translate(self.error_message)) if isinstance(value, LazyCrypt): return (value, None) return

[web2py] Re: login_bare custom validation

2015-10-05 Thread 'DenesL' via web2py-users
The error is gone but the login does not work. This needs more thought. On Monday, October 5, 2015 at 2:51:22 PM UTC-4, DenesL wrote: > > Tracing the execution it shows that the password is converted to a > LazyCrypt object and then validated using the field's requires which uses >

[web2py] Re: login_bare custom validation

2015-10-05 Thread 'DenesL' via web2py-users
Hi again alternatively, could anyone post some working code sample of using validation with login_bare? the examples from the book and some posts in the forum were not enough for me. Thanks, Denes On Saturday, October 3, 2015 at 7:58:52 PM UTC-4, DenesL wrote: > > Hello all, > > Trying to do