thank you so much for your detail explaination, Vinicius Assef. i like what u've wrote on your blog. just for info, i'd realized that if you want to validate self reference table, it can do on the define table (returns an error)
On Sun, May 1, 2011 at 10:22 AM, Vinicius Assef <vinicius...@gmail.com>wrote: > Stifan, > a Field() may have many properties adjusted and it turns difficult to > read define_table(), mainly due to multiple validators. > Note that validators stablish FORM() behaviour, not a database table > behaviour. So, mixing layers is not a good practice, right? > > Separating them will guarantee that if you need some cross reference, > it will work, in spite of table order creation. An example here is the > IS_IN_DB validator. > > Keeping them separeted from each other, allows you to make tests and > debug in an a differente approach, isolating problems and behaviour. > > -- > Vinicius Assef. > > > On Sat, Apr 30, 2011 at 11:30 PM, Stifan Kristi > <steve.van.chris...@gmail.com> wrote: > > nice info, viniclusban, btw, > > First, because web2py recommends you don't mix validators > > with db.define_table(). > > is it the best practice to not mix requires on the same time with field > > create? > > e.g. > > db.define_table('category', > > Field('category' > > ) > > ) > > db.category.requires = IS_NOT_EMPTY() > > is better than : > > db.define_table('category', > > Field('category', > > requires = IS_NOT_EMPTY() > > ) > > ) > > please give an advice or pointer about this? > > thank you so much > > > > On Sun, May 1, 2011 at 9:22 AM, Vinicius Assef <vinicius...@gmail.com> > > wrote: > >> > >> Buddies, I'd like to hear your oppinions about this post in my blog: > >> http://bit.ly/mCH7rr > >> > >> -- > >> Vinicius Assef. > > > > >