Yes I agree with this situation it is only on the login. Every other part
of the site uses the real username. Thanks for the explanation of Massimo's
example Bruno and Anthony.

On Fri, Mar 30, 2012 at 12:56 PM, Anthony <abasta...@gmail.com> wrote:

> Your correct your solution Anthony works.
>>
>> Massimo, I am not sure I understand what db.auth_user.username.req**
>> uires.insert(0, MyStrangeRequi**rement()) is doing?
>>
>
> Massimo's solution does the same thing but by creating a custom validator
> and adding the validator to the "requires" attribute of the "username"
> field. See http://web2py.com/books/default/chapter/29/7#Custom-validators.
> A custom validator can be more convenient because once it is added to the
> field it will automatically be applied to any SQLFORM (you don't have to
> set an onvalidation function for every SQLFORM), and it will also be
> applied when records are inserted via the .validate_and_insert() method
> (onvalidation functions don't apply in that case, as it doesn't involve any
> form processing). In this case, though, we only want the validation to
> happen with login, not with other forms or inserts/updates that may include
> the username field, so a custom validator probably doesn't have any
> advantage over an onvalidation function in this case.
>
> Anthony
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com

Reply via email to