In article <[email protected]>,
Ben Cohen  <[email protected]> wrote:
>
>eg -- I'd like to do something like this:
>
>errors = []
>for item in data:
>    try:
>        process(item)
>    except ValidationError as e:
>        errors.append(e)
>raise MultipleValidationErrors(*errors)

First of all, please DO NOT post code with TABs in it.  In fact, you
shouldn't even be writing code with TABs -- TAB characters are obsolete
for new Python code.

I would write your code this way:

errors = []
for item in data:
    try:
        process(item)
    except ValidationError as e:
        errors.append(str(e))
if errors:
    raise MultipleValidationErrors(errors)
-- 
Aahz ([email protected])           <*>         http://www.pythoncraft.com/

f u cn rd ths, u cn gt a gd jb n nx prgrmmng.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to