On 11 Aug 2012, at 8:51 PM, Rob_McC <[email protected]> wrote:
> I never got this to work, as I mentioned above
> auth.define_tables(username=True)
> db.auth_user.username.requires.insert(0,IS_MATCH("[a-z].*"))
>
> I get this error:
>
> Ticket ID
> 127.0.0.1.2012-08-11.23-47-00.29b15810-8243-46b8-802f-153225e295fe
> <type 'exceptions.AttributeError'> 'tuple' object has no attribute 'insert'
>
> I now understand the .insert with lists etc, and why if I don't .insert, it
> will not fire the web2py validators.
> But I don't see what is wrong with the example
>
Tuples, unlike lists, are immutable, so no insert. I suppose you could write
db.auth_user.username.requires = (IS_MATCH("[a-z].*"),) +
db.auth_user.username.requires
--