Oh, I see.

Wouldn't it be better than to map failed arguments to corresponding formencode.Invalid exceptions.

For simple error handling and reporting one can than just iterate through arguments and display an error message where appropriate. Taking it a step further, such behaviour could be integrated into widgets themselves, requiring not code what so ever to handle simple forms.

Simon

Kevin Dangoor wrote:
On 1/25/06, Simon Belak <[EMAIL PROTECTED]> wrote:
Probably I am overlooking something but for the life of me I can't work
out what _call_with_errors() is suppose to do.

If I understand correctly, it just fills all omitted keyword arguments
with None. But isn't this what the defaults are for?

Not exactly. This is for the current error handling scheme... Let's
say you have something like this:

@turbogears.expose()
@turbogears.validate(form=myform)
def save(self, name, age):
    if cherrypy.request.form_errors:
        ...

If "age" is expected to be an int and comes up invalid, I don't want
to pass the bad value into the method. So, the invalid values just get
turned into Nones and the method being called can decide what to do
with the errors. @error_handler would likely make this cleaner and
probably remove the need for call_with_errors.

Kevin



--
Simon Belak
vodja projektnih skupin

e: [EMAIL PROTECTED]
---------------------------------------------------------------------
Hruska d.o.o., agencija za nove medije
Ilirska 21, SI-1000 Ljubljana

t: +386 1 430 25 86                      f: +386 1 430 25 87

s: http://www.hruska.si
s: http://akademija.hruska.si (izobrazevalni portal)
s: http://www.elor.si (kadrovski sistem letnih razgovorov)
------------------------------------------------------------------------
Hruska.si - socne resitve


To elektronsko sporocilo in vse morebitne priloge so poslovna skrivnost in namenjene izkljucno naslovniku. Ce ste sporocilo prejeli pomotoma, Vas prosimo, da obvestite posiljatelja, sporocilo pa takoj unicite. Kakrsnokoli razkritje, distribucija ali kopiranje vsebine sporocila je strogo prepovedano.

This e-mail and any attachments may contain confidential and/or privileged information and is intended solely for the addressee. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail, or any action taken or omitted to be taken in reliance on it, is strictly prohibited.

Reply via email to