This one exists in 0.5 as well, I was going to mention it.

You need to have a def validation _error method as the TG code works for
that case but the if the method does not exist, the default "raise a
traceback" code is missing arguments.  I never bothered to figure out
the fix, though.  I just created a validation_error method on my controller.

I am trying to say with virgin stable releases as much as possible for
my project.

Hope this helps.

Krys

[EMAIL PROTECTED] wrote:

>======================
>2005/10/07 16:44:22  INFO Traceback (most recent call last):
>  File
>"/home/gary/lib/python2.4/site-packages/CherryPy-2.1.0_rc1-py2.4.egg/cherrypy/_cphttptools.py",
>line 272, in run
>    main()
>  File
>"/home/gary/lib/python2.4/site-packages/CherryPy-2.1.0_rc1-py2.4.egg/cherrypy/_cphttptools.py",
>line 498, in main
>    body = page_handler(*args, **cherrypy.request.paramMap)
>  File
>"/home/gary/lib/python2.4/site-packages/TurboGears-0.8a1dev-py2.4.egg/turbogears/controllers.py",
>line 119, in newfunc
>    raise turbogearsvalid.Invalid(str(errors))
>TypeError: __init__() takes at least 4 arguments (2 given)
>=============================================
>turbogearsvalid is simply validators from formencode, the Invalid class
>is like the following :
>
>class Invalid(Exception):
>
>    """
>    This is raised in response to invalid input.  It has several
>    public attributes:
>
>    msg:
>        The message, *without* values substituted.  For instance, if
>        you want HTML quoting of values, you can apply that.
>    substituteArgs:
>        The arguments (a dictionary) to go with `msg`.
>    str(self):
>        The message describing the error, with values substituted.
>    value:
>        The offending (invalid) value.
>    state:
>        The state that went with this validator.  This is an
>        application-specific object.
>    error_list:
>        If this was a compound validator that takes a repeating value,
>        and sub-validator(s) had errors, then this is a list of those
>        exceptions.  The list will be the same length as the number of
>        values -- valid values will have None instead of an exception.
>    error_dict:
>        Like `error_list`, but for dictionary compound validators.
>    """
>
>    def __init__(self, msg,
>                 value, state, error_list=None, error_dict=None):
>        Exception.__init__(self, msg)
>        self.msg = msg
>        self.value = value
>        self.state = state
>        self.error_list = error_list
>        self.error_dict = error_dict
>
>
>  
>

Reply via email to