look the code in dal.py referencing check_reserved, you can copy patterns
and dicts from there in to your validator.

http://zerp.ly/rochacbruno
Em 03/02/2012 06:41, "Manuele Pesenti" <[email protected]> escreveu:

> Hi!
> Can you suggest me how can I write a validator for sql table names?
>
> I mean... I have a plugin that let me define tables and fields through the
> web interface saving their name and parameters in the db itself. So I have
> a "meta" table for the tables I want to define. I'm looking for a good
> validator for the "meta" field that contains table names.
>
> They have to be unique and respect all SQL conventions. At the moment I
> solved in this way:
>
> Field('tab_name', label=T('Table name'), unique=True, required=True,
>                requires=IS_MATCH('^[a-z0-9_]***$', error_message=T('Not a
> valid table name!')))
>
> Thank you very mutch
>
>    Manuele
>

Reply via email to