[Zope-dev] Suggestion - ZSQL methods should include name in error messages

2002-11-16 Thread Skip Montanaro

I'm using Zope 2.5.1 (and can't upgrade for the time being).  If this has
been fixed in a later version, my apologies for the needless request.

When a ZSQL method is called without a required input parameter, it
generates an error like

Missing input variable, group_id

Since such methods might be called indirectly, it's not always obvious which
ZSQL method was called or who called it.  I would find it helpful if the
error message included at least the name of the called method.  Ideally,
traceback information should be available as well.  This particular message
seems to be generated by something other than the usual error machinery.

-- 
Skip Montanaro - [EMAIL PROTECTED]
http://www.mojam.com/
http://www.musi-cal.com/

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



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

2000-10-03 Thread Skip Montanaro


I occasionally get tracebacks like

No input for required field
!--
Traceback (innermost last):
  File /home/killer-whale/skip/src/Zope/lib/python/ZPublisher/Publish.py, line 
222, in publish_module
  File /home/killer-whale/skip/src/Zope/lib/python/ZPublisher/Publish.py, line 
136, in publish
  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)

--

mailed to me from my production web server (5-10 times per day).  I have
been so far unable to figure out what request is coming into Zope that is
triggering it by examining the Zope and Apache server logs (I run Zope
behind an Apache proxy).  Every time I search the log files in the vicinity
of the mail message's timestamp, I see nothing wrong.  I would like to
instrument the Zope code to generate a traceback that has a more useful
message than "(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 am completely unfamiliar with the code involved in the above traceback,
and only get such tracebacks on my production server, so I need to get it
right the first time.  (If I muff it, it will almost certainly not break
until right after have watched it for 10 hours, then left for the day,
allowing the server to choke for 12-15 hours before I come in the next
day...)  I'd like to enclose one of the calls in the above traceback in a
try: ... except ValueError: ... statement whose except clause reraises the
exception with the relevant data that will tell me just what method was
invoked and what parameters, if any, it's receiving.  I think the
HTTPRequest class probably contains the useful bits, but I have no idea what
those bits might be.  (What is the saying about things that are sufficiently
subtle appear to be magic to the observer?)

Thanks,

-- 
Skip Montanaro ([EMAIL PROTECTED])
http://www.mojam.com/
http://www.musi-cal.com/

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




[Zope-dev] Suggestion for better Zope error response

2000-09-25 Thread Skip Montanaro


Suppose you have a simple form like:

html
form action="http://www.musi-cal.com/search" method="post"
City: input name="performers" type="text"
Radius: input name="radius:int" type="text"
input type="submit" name="submit" value="Search"
/form
/html

and the user submits the form with an invalid input for the radius.
Assuming ZServer was not run with -D, other than the standard boilerplate,
all the user sees is

exceptions.ValueError

However, field2int raised ValueError with a string like

ValueError: An integer was expected in the value 'wer'

Making this available to the user, even in the non-debug case, seems like it
would be useful feedback for the user that could help guide them to their
mistake.

-- 
Skip Montanaro ([EMAIL PROTECTED])
http://www.mojam.com/
http://www.musi-cal.com/

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )