I'm trying to catch when someone tries to create an object with the same Id as another object. I thought this was handled by checkValidId. It doesn't appear that this error is handled by standard_error_message. Whenever this error happens, the rror message is not skinned like the site I'm working on (ie. It's just some very basic html output). Thanks, Tom -----Original Message----- From: Dieter Maurer [mailto:dieter@handshake.de] Sent: Saturday, March 04, 2006 2:29 PM To: Palermo, Tom Cc: 'zope@zope.org' Subject: Re: [Zope] catching BadRequest exceptions Palermo, Tom wrote at 2006-3-3 13:56 -0500:
... It seems that BadRequest exceptions, like the ones thrown by checkValidId() in OFS.ObjectManager (lib/python/OFS/ObjectManager.py), are not handled by a standard_error_message.
Some "BadRequest" exceptions are not handled by "standard_error_message" (a bug, please file a bug report). But, this is not the case for the one from "checkValidId". Affected are errors detected in "REQUEST.processInputs()". They are not handled by "standard_error_message" because they are detected too early -- before traversal has even begun. As a result, there is not yet any "standard_error_message" in the request context. These errors are usually type errors during conversion of request parameters called for by ":<type>" suffixes, e.g. "start:int=a" would cause such an error. The easy workaround is not to use such ZPublisher type conversions but perform the conversions yourself in your application code. -- Dieter