validators are also filters so the order is important. IS_LOWER goes
before IS_IN_DB

On Oct 28, 8:57 am, Doxaliber <[email protected]> wrote:
> This is my model:
> -----------------------------------------------------------------------------------------------------------------
> db.define_table('autori',
>     Field('nome_autore', 'string', length=300),
>     Field('bio', 'text'))
>
> db.define_table('case_discografiche',
>     Field('nome_casa_discografica', 'string', length=300),
>     Field('bio_casa_discografica', 'text'))
>
> db.define_table('generi',
>     Field('genere_musicale','string', length=300))
>
> db.define_table('albums',
>     Field('autore', db.autori),
>     Field('titolo', 'string', length=600),
>     Field('genere','string', length=600),
>     Field('tracklist','text'),
>     Field('casa_discografica', db.case_discografiche),
>     Field('copertina', 'upload'))
>
> db.albums.autore.requires = IS_IN_DB(db, db.autori.id,'%(nome_autore)
> s')
> db.albums.casa_discografica.requires = IS_IN_DB
> (db,db.case_discografiche.id,'%(nome_casa_discografica)s')
> db.autori.nome_autore.requires = IS_NOT_EMPTY()
> db.case_discografiche.nome_casa_discografica.requires = IS_NOT_EMPTY()
> db.albums.titolo.requires = IS_NOT_EMPTY()
> db.albums.genere.requires = IS_IN_DB(db,db.generi.id,'%
> (genere_musicale)s', multiple=True)
> db.autori.nome_autore.requires = IS_NOT_EMPTY(), IS_NOT_IN_DB(db,
> 'autori.nome_autore')
> db.case_discografiche.nome_casa_discografica.requires = IS_NOT_EMPTY
> (), IS_NOT_IN_DB(db, 'case_discografiche.nome_casa_discografica')
> db.generi.genere_musicale.requires = IS_NOT_EMPTY(), IS_NOT_IN_DB(db,
> 'generi.genere_musicale'), IS_LOWER()
> -------------------------------------------------------------------------------------------------------------------------------------
>
> If I insert "rock" as generi.genere and then I try to insert Rock also
> the second record is accepted, the R is converted to lowercase and I
> have two rock genres inserted! Is this a bug or I'm making something
> wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to