[Zope-dev] Need help tracking down the cause of a traceback

Dieter Maurer dieter@handshake.de
Wed, 4 Oct 2000 13:32:26 +0200 (CEST)


Hi Skip,

Skip Montanaro writes:
 > 
 > I occasionally get tracebacks like
 > 
 >     No input for required field
 >     ....
 >       File /home/dolphin/skip/src/Zope/lib/python/ZPublisher/HTTPRequest.py, line 445, in processInputs
 >       File /home/dolphin/skip/src/Zope/lib/python/ZPublisher/Converters.py, line 115, in field2required
 >     ValueError: (see above)
 > 
 > The ValueError is being raised in field2required, but I see no parameters in
 > the Apache log with a name of "...:required".  That leads me to suspect that
 > somehow the RESPONSE parameter isn't getting set (it's the only
 > non-defaulted parameter in the suspect published methods that doesn't appear
 > to have its value set directly by parameters in the URL).

I suspect the problem comes from a "POST" operation.
You will not see POST operation parameters in the web server log
files.

It is highly unlikely that a missing RESPONSE causes the problem.
Such an error would be handled at a different place (I think
in "mapply").

At line 444 of "ZPublisher/HTTPRequest.py", you will see the following
code:
                    if flags&CONVERTED:
                        try:
                            item=converter(item)
                        except:
                            if (not item and not (flags&DEFAULT) and
                                defaults.has_key(key)):
                                item = defaults[key]
                                if flags&RECORD:
                                    item=getattr(item,attr)
                                if flags&RECORDS:
                                    item.reverse()
                                    item = item[0]
                                    item=getattr(item,attr)
                            else:
                                raise                            

Add "print key; sys.stdout.flush()" before the final "raise".
This will print the corresponding "key" (with is missing).

To get more information: the variable "fslist" contains all
parameters. It is a list of objects. Each object has a "name"
attribute (which gives the form variable name or 'key'),
the object either has a "file" or "value" attribute.
You may look at line 370, to see how it is processed.

You can test your debugging code in your test environment.
Simply create a form with a "xxx:required" variable name
and do not provide a value.


Dieter