Max Ischenko rightly brings up confusion with defined validators where
no value comes in:
http://trac.turbogears.org/turbogears/ticket/389

As an example:
@turbogears.expose(validators = {
                'page':validators.Int(if_empty=0),
            })
def index(self, **kw):
           # here I'd assume kw[page] always exists
           # and is 0 unless specified by the user

In the current code, if the request doesn't contain "page", the
validator is *not* run. This is to support this:

@turbogears.expose(validators = {
                'page':validators.Int(),
            })
def index(self, page=1):
           # here I'd assume kw[page] always exists
           # and is 1 unless specified by the user

My thought was that if there's a default defined on the method and the
value does not come in in the request, just use the default on the
method. If there *isn't* a default on the method, then the validator
should always be run.

Kevin

--
Kevin Dangoor
Author of the Zesty News RSS newsreader

email: [EMAIL PROTECTED]
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com

Reply via email to