[web2py] Re: validators

2019-11-04 Thread Scott Hunter
You could write one to do this & use it where you need to. On Monday, November 4, 2019 at 12:00:47 AM UTC-5, T.R.Rajkumar wrote: > > sqlform filed validators do not check for the precision of decimal fields. > It would be nice it web2py validates the precision of fields. > -- Resources: - http:

[web2py] Re: validators don't work on list

2015-03-30 Thread LoveWeb2py
:'( I'll try to find a workaround, but this would be a nice addition in the future releases. On Monday, March 30, 2015 at 12:32:17 PM UTC-4, Anthony wrote: > > Hmm, looks like advanced search is not implemented for list:-type fields > in the grid. > > On Monday, March 30, 2015 at 12:17:09 PM UT

[web2py] Re: validators don't work on list

2015-03-30 Thread Anthony
Hmm, looks like advanced search is not implemented for list:-type fields in the grid. On Monday, March 30, 2015 at 12:17:09 PM UTC-4, LoveWeb2py wrote: > > Hi Anthony, > > Yes I'm talking about the advanced search form in the grid. > > When you set a field type to list:string you no longer have

[web2py] Re: validators don't work on list

2015-03-30 Thread LoveWeb2py
Hi Anthony, Yes I'm talking about the advanced search form in the grid. When you set a field type to list:string you no longer have the ability to select the field from the dropdown menu to create specific searches. Does that help to clarify? for example if I have Field('myFieldA', string')

[web2py] Re: validators don't work on list

2015-03-30 Thread Anthony
Can you clarify the problem? Are you talking about the advanced search form in the grid? What exactly is the issue? On Monday, March 30, 2015 at 11:29:54 AM UTC-4, LoveWeb2py wrote: > > Thank you, Anthony! This solved it. > > Should I use IS_LIST_OF() to enable the search function in SQLFORM? >

[web2py] Re: validators don't work on list

2015-03-30 Thread LoveWeb2py
Thank you, Anthony! This solved it. Should I use IS_LIST_OF() to enable the search function in SQLFORM? On Monday, March 30, 2015 at 10:35:19 AM UTC-4, Anthony wrote: > > Near the end of this section > > > of the

[web2py] Re: validators don't work on list

2015-03-30 Thread Anthony
Near the end of this section of the book, it notes that the only validators that work with list:-type fields are IS_IN_SET(..., multiple=True), IS_IN_DB(..., multiple=True), IS_NOT_EMTPY(), and IS_LIST_OF(). The lat

[web2py] Re: validators don´t work for db fields

2014-05-02 Thread Niphlod
what is the expected result ? of course if a domain already exist in the table, a error is raised ... On Thursday, May 1, 2014 11:31:14 PM UTC+2, Thomas Neubrand wrote: > > Hello, > > I have two validators in my db.py for my *auth_user* table for the > password and the domain field, but both

[web2py] Re: Validators problems

2014-02-10 Thread Niphlod
you're redefining the validator for the same field. If you need both, use requires as a list of validators. BTW: why don't you just use is_in_db ? is it because of the error message ? On Monday, February 10, 2014 6:10:41 PM UTC+1, ninni@gmail.com wrote: > > external_data = gluon.contrib.simpl

[web2py] Re: Validators - default messages

2014-01-15 Thread Kiran Subbaraman
Done. Issue: https://code.google.com/p/web2py/issues/detail?id=1853, and sent a pull-request too. On Thursday, January 16, 2014 1:06:11 AM UTC+5:30, Anthony wrote: > > On Wednesday, January 15, 2014 1:47:26 PM UTC-5, Kiran Subbaraman wrote: >> >> I was just using some of the validators, like IS_

[web2py] Re: Validators - default messages

2014-01-15 Thread Anthony
On Wednesday, January 15, 2014 1:47:26 PM UTC-5, Kiran Subbaraman wrote: > > I was just using some of the validators, like IS_EMAIL(), IS_NOT_EMPTY(), > and noticed that the error messages that it returns do not have the first > character capitalized. > Basically I see error messages like '*e*n

[web2py] Re: Validators

2011-11-15 Thread Jay
Thanks. IS_EMPTY_OR() will do just fine. On Nov 15, 2:08 pm, Richard Vézina wrote: > IS_EMPTY_ORhttp://web2py.com/book/default/chapter/07IS_EMPTY_OR > Search for IS_EMPTY_OR in this page : > > http://web2py.com/book/default/chapter/07 > > I think : > > requires = IS_EMPTY_OR >

[web2py] Re: Validators, when are they necessary ?

2011-11-03 Thread Archibald Linx
Thank you Anthony. Your answers are always very clear. Archibald On 2 nov, 22:15, Anthony wrote: > On Wednesday, November 2, 2011 4:46:45 PM UTC-4, Archibald Linx wrote: > > > Dear Web2py users, > > > I have a few questions about validators, especially : when are they > > necessary ? > > > For e

[web2py] Re: Validators, when are they necessary ?

2011-11-02 Thread Anthony
On Wednesday, November 2, 2011 4:46:45 PM UTC-4, Archibald Linx wrote: > > Dear Web2py users, > > I have a few questions about validators, especially : when are they > necessary ? > > For example, if I have like in chapter 3 ( > http://www.web2py.com/book/default/chapter/03?search=image_id ) :

[web2py] Re: validators with DAL (stand alone)?

2011-06-21 Thread mart
awesome! thanks for the info! i'll use validate_and_insert & validate_and_update (i think that should do it), and I look forward to seeing your Rows.validade_and_update_record()! :) thanks, Mart On Jun 21, 11:08 pm, Bruno Rocha wrote: > Some more examples: > > *IS IN SET* > In [29]: IS_IN_SET([1

[web2py] Re: Validators for webservices?

2011-03-20 Thread Marcel Luethi
Hi Kevin Thanks for your input! This is a valuable solution. But I would still need to add all my already existing validators to SQLFORM.factory. Wouldn't I? Therefore I tried Massimo's solution first. Best regards, Marcel On 20 Mrz., 15:43, Kevin Ivarsen wrote: > Massimo's method may be be

[web2py] Re: Validators for webservices?

2011-03-20 Thread Marcel Luethi
Hi Massimo After upgrading to 1.94.5 it works perfectly. Thank you very much! Is there anywhere some documentation regarding request.restful() besides your video and the thread here on Google groups? Great stuff! Regards, Marcel On 20 Mrz., 15:20, Massimo Di Pierro wrote: > This: > > @serv

[web2py] Re: Validators for webservices?

2011-03-20 Thread Kevin Ivarsen
Massimo's method may be better -- I haven't personally experimented with the restful stuff yet. But you can still use SQLFORM or SQLFORM.factory with form.accepts() to run the validators. You just don't display the form anywhere if you don't need to. You also need to pass formname=None to acce

[web2py] Re: Validators for webservices?

2011-03-20 Thread Massimo Di Pierro
This: @service.jsonrpc def update(record): errors = validate(db.mytable, record) if errors: return dict(success=False, msg=', '.join(errors)) else: db(db.mytable.id == record.id).update(record) return dict(success=True) should be @request.restful() def update

[web2py] Re: validators order

2010-11-10 Thread andrej burja
thank you it is too obvious to see that i made replacement of the validators :) On Nov 4, 10:24 am, DenesL wrote: > On Nov 3, 3:52 pm, andrej burja wrote: > > > hi > > > why is order of validators important? > > i have > > > db.tecaj.voditelj.requires=IS_NOT_EMPTY() > > db.tecaj.voditelj.require

[web2py] Re: validators order

2010-11-04 Thread DenesL
On Nov 3, 3:52 pm, andrej burja wrote: > hi > > why is order of validators important? > i have > > db.tecaj.voditelj.requires=IS_NOT_EMPTY() > db.tecaj.voditelj.requires=IS_IN_DB(db,'person.id','%(name)s') > > why does putting the IS_NOT_EMPTY() at the end doesn't produce > dropdown list? Your c

[web2py] Re: validators order

2010-11-03 Thread mdipierro
The oreder is important because validators are filters. requires=[A,B,C] input -> A -> B -> C -> database database -> ~C -> ~B ->~A -> output You get a dropdown if there is a single validator that has an options attribute. On Nov 3, 2:52 pm, andrej burja wrote: > hi > > why is order of valida

[web2py] Re: Validators allow empty

2010-10-13 Thread Joe J
Thanks DenesL, I'll give that a try. Thanks for the advice. On Oct 13, 4:53 am, DenesL wrote: > Hi Joe, > > use IS_EMPTY_OR as in > > IS_EMPTY_OR(IS_EMAIL(error_message=T('Invalid email address.'))) > > Denes > > On Oct 13, 3:55 am, Joe J wrote: > > > > > This is probably an easy question, but

[web2py] Re: Validators allow empty

2010-10-13 Thread DenesL
Hi Joe, use IS_EMPTY_OR as in IS_EMPTY_OR(IS_EMAIL(error_message=T('Invalid email address.'))) Denes On Oct 13, 3:55 am, Joe J wrote: > This is probably an easy question, but I'm looking for a way to > validate a field if it is given, but let it pass if it is empty. > Currently, the following

[web2py] Re: Validators with Dependencies

2010-09-17 Thread mart
oh... good one! didn't realize you could do that! :) as part of the admin, would it be worth it to put that functionality as a "pre-setup" of apps? hum jquery + drag&drop in to a db design canvas for designing tables? or while we are on it, maybe a lot of app setup steps could be done this way

[web2py] Re: Validators with Dependencies

2010-09-17 Thread mdipierro
Before we do this, I suggest you install plugin_wiki and do db.define_table('lists', Field('name')) def create_list(): return dict(form=crud.create(db.lists)) def edit_list(): mylist=db.lists(request.args(0)) or redirect(URL('create_list')) return dict(items=plugin_wiki.widget('tags'

[web2py] Re: validators with dependencies

2010-06-27 Thread Alastair Medford
Ah that makes a lot more sense, I should not code tired. I also tried out IS_EQUAL_TO() and works like a charm. Thanks. On Jun 27, 3:31 am, mdipierro wrote: >  IS_EXPR('value==repr(request.vars.password)', > > should be > >  IS_EXPR('value==%s' % repr(request.vars.password), > > Anyway, this seem

[web2py] Re: validators with dependencies

2010-06-27 Thread mdipierro
IS_EXPR('value==repr(request.vars.password)', should be IS_EXPR('value==%s' % repr(request.vars.password), Anyway, this seems to come up a lot, so I added a new validator in trunk: IS_EQUAL_TO(request.vars.password) Please give it a try. On Jun 27, 1:52 am, Alastair Medford wrote: > Alri

[web2py] Re: validators, min and max

2010-02-08 Thread mdipierro
yes. better On Feb 8, 11:04 am, Jonathan Lundell wrote: > On Feb 8, 2010, at 8:34 AM, mdipierro wrote: > > > send me a patch! > > I'd suggest otherwise--in particular interpreting None as "no limit" in the > min or max direction. > > Interpreting (4) as (0,4) saves the developer two characters o

Re: [web2py] Re: validators, min and max

2010-02-08 Thread Jonathan Lundell
On Feb 8, 2010, at 8:34 AM, mdipierro wrote: > send me a patch! I'd suggest otherwise--in particular interpreting None as "no limit" in the min or max direction. Interpreting (4) as (0,4) saves the developer two characters of typing. But interpreting (4, None) or (None, 4) as no limit extends

[web2py] Re: validators, min and max

2010-02-08 Thread mdipierro
I am for it. On Feb 8, 10:41 am, Jonathan Lundell wrote: > On Feb 8, 2010, at 8:13 AM, DenesL wrote: > > > Having had the need recently, I would like to see: > > IS_INT_IN_RANGE(1) # any integer>0 (up to sys.maxint) > > IS_INT_IN_RANGE(max=10) # any integer less than 10 > > and similarly for IS_F

Re: [web2py] Re: validators, min and max

2010-02-08 Thread Jonathan Lundell
On Feb 8, 2010, at 8:13 AM, DenesL wrote: > Having had the need recently, I would like to see: > IS_INT_IN_RANGE(1) # any integer>0 (up to sys.maxint) > IS_INT_IN_RANGE(max=10) # any integer less than 10 > and similarly for IS_FLOAT_IN_RANGE(). > Suggestion: interpret None as no limit. So your t

[web2py] Re: validators, min and max

2010-02-08 Thread pihentagy
On Feb 8, 5:13 pm, DenesL wrote: > On Feb 8, 4:15 am, "KONTRA, Gergely" wrote:> Hi! > > IS_FLOAT_IN_RANGE(0,10) will accept 10, and will accept 0. > > Since there is no equivalent in Python this one works as one would > normally expect. Errr, so, INTs works as python ranges, and contrary, floats

[web2py] Re: validators, min and max

2010-02-08 Thread mdipierro
send me a patch! On Feb 8, 10:24 am, "KONTRA, Gergely" wrote: > >> And does it makes sense to make all min and max values optional, so > >> you can have: enter an integer, which is larger than 2 (witout upper > >> limit)? > > Having had the need recently, I would like to see: > > IS_INT_IN_RANGE(

[web2py] Re: validators, min and max

2010-02-08 Thread DenesL
LOL, you got me there... Can we make an exception? ... just kidding. On Feb 8, 11:24 am, "KONTRA, Gergely" wrote: > >> And does it makes sense to make all min and max values optional, so > >> you can have: enter an integer, which is larger than 2 (witout upper > >> limit)? > > Having had the need

Re: [web2py] Re: validators, min and max

2010-02-08 Thread KONTRA, Gergely
>> And does it makes sense to make all min and max values optional, so >> you can have: enter an integer, which is larger than 2 (witout upper >> limit)? > Having had the need recently, I would like to see: > IS_INT_IN_RANGE(1) # any integer>0 (up to sys.maxint) > IS_INT_IN_RANGE(max=10) # any inte

[web2py] Re: validators, min and max

2010-02-08 Thread DenesL
On Feb 8, 4:15 am, "KONTRA, Gergely" wrote: > Hi! > > I found another inconsistency in validators: > > IS_INT_IN_RANGE: > > IS_INT_IN_RANGE(0,10) does not accepts 10. That is by design so that it works as the Python range built-in function. range(0,10) = [0,1,2,3,4,5,6,7,8,9] > > Yes, this is in t

Re: [web2py] Re: validators, form validation

2010-01-14 Thread KONTRA, Gergely
I cloned web2py and write 2 functions for that http://code.google.com/r/pihentagy-web2py/source/list You can use those classes like that: Field('invoice_date','date', requires=IS_DATE_IN_RANGE(minimum=datetime.date.today(), format='%d/%m/%Y')), Field('settlement_date','datetime', requires=

[web2py] Re: validators, form validation

2010-01-11 Thread mdipierro
Not sure I understand what is status enumeration. Any constant defined in models will be visible in controllers On Jan 11, 4:53 pm, "KONTRA, Gergely" wrote: > Hmm, seems to be not a good idea to write more topics in one > message... Anybody on the enumeration part? > +-[ Gergely Kontra  ]---

[web2py] Re: validators, form validation

2010-01-11 Thread KONTRA, Gergely
Hmm, seems to be not a good idea to write more topics in one message... Anybody on the enumeration part? +-[ Gergely Kontra  ]--+ |   | | Mobile:(+36 20)356 9656   | |

[web2py] Re: validators, form validation

2010-01-11 Thread mdipierro
On Jan 11, 11:19 am, pihentagy wrote: > On Jan 11, 2:57 pm, mdipierro wrote: > > > You can create your own field-level validators > > > class validator: > >    def __init__(self,error_message): self.error_message=error_message > >    def __call__(self,value): > >        if success: return (valu

[web2py] Re: validators, form validation

2010-01-11 Thread pihentagy
On Jan 11, 2:57 pm, mdipierro wrote: > You can create your own field-level validators > > class validator: >    def __init__(self,error_message): self.error_message=error_message >    def __call__(self,value): >        if success: return (value,None) >        else: return (value,self.error_messag

[web2py] Re: validators, form validation

2010-01-11 Thread mdipierro
You can create your own field-level validators class validator: def __init__(self,error_message): self.error_message=error_message def __call__(self,value): if success: return (value,None) else: return (value,self.error_message) both form.accept and crud.create/crud.update tak