[Zope] Still Chipping Away At Formulator/ZPT Interface

Skip Montanaro skip@pobox.com
Wed, 6 Nov 2002 12:00:55 -0600


    beno> Error Type: Attribute Error
    beno> Error Val: args

    beno> and it comes from this script:

    beno> try:
    beno>    result = context.email_us_formulator.validate_all(context.REQUEST)
    beno> except FormValidationError, errlist:
    beno>    for item in errlist:
    beno>      return "<", item.args, ">"

That looks like my (also non-working) code you're trying to execute!  

    beno> Now, from the Errors.py script we have the following:

    beno> class FormValidationError(Exception):

    beno>      def __init__(self, errors, result):
    beno>          Exception.__init__(self,"Form Validation Error")
    beno>          self.errors = errors
    beno>          self.result = result

    beno> So, what is *args*? Is this something defined in Python itself?

The thing that confuses me is that Exception does define an args attribute:

    % /Applications/Plone/Python/bin/python
    Python 2.1.3 (#2, Sep 16 2002, 19:32:07) 
    [GCC 3.1 20020420 (prerelease)] on darwin6
    Type "copyright", "credits" or "license" for more information.
    >>> dir(Exception())
    ['args']
    >>> Exception().args
    ()

I don't know why it wouldn't be available.  It doesn't appear to be deleted
by any Formulator code.  I asked about this a few days ago but don't
remember seeing a response.

As you can see from the code you quoted, item.errors and item.result should
exist though.

-- 
Skip Montanaro - skip@pobox.com
http://www.mojam.com/
http://www.musi-cal.com/