[Zope] ZDebug 0.2 incompatible with Formulator 1.0

Dieter Maurer dieter@handshake.de
Sat, 28 Jul 2001 12:14:35 +0200 (CEST)


--cgT1ZhECWA
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit

Just analysed a strange exception during form validation with
Formulator:

  Zope reported a "TypeError: expected 3, got 2 arguments"
  from "ZDebug.DTMLDebug.py:184".
  This is in the middle of a call to "dtmlexc", no function call
  around.

  It turned out that:

      The problem was the creation of the exception object.
      ZDebug assumes that exceptions accept a single string
      argument, but "FormValidationError" wants 2 arguments.

Attached is a patch trying to work around the problem:

  It raises the exception in a "try ... except".
  When this raises the expected exception, then it is reraised;
  otherwise, the original exception is raised (which is
  not so good as the ZDebug Message but better than nothing).

Dieter

--cgT1ZhECWA
Content-Type: application/x-patch
Content-Description: ZDebug Patch to let is better harmonize with products defining their own exception classes
Content-Disposition: attachment;
	filename="ZDebug-Exc.pat"
Content-Transfer-Encoding: base64

LS0tIERUTUxEZWJ1Zy5weX4JVGh1IEp1bCAyNiAyMzo0Njo1OSAyMDAxCisrKyBEVE1MRGVi
dWcucHkJU2F0IEp1bCAyOCAxMjowOTozMiAyMDAxCkBAIC0xNzAsMTAgKzE3MCwxMCBAQAog
ICAgICAgICAgICAgY2FsbF9zdGFjayA9IE5vbmUKICAgICAgICAgIyBPdXRwdXQgdGhlIGNv
bGxlY3RlZCBpbmZvcm1hdGlvbi4KICAgICAgICAgaWYgZXhjX2luZm8gaXMgbm90IE5vbmU6
CiAgICAgICAgICAgICBleGNfdHlwZSA9IGV4Y19pbmZvWzBdCiAgICAgICAgICAgICBleGNf
dHlwZSA9IHN0cihnZXRhdHRyKGV4Y190eXBlLCAnX19uYW1lX18nLCBleGNfdHlwZSkpCi0g
ICAgICAgICAgICByYWlzZSBleGNfaW5mb1swXSwgZHRtbGV4YyhOb25lLCBOb25lLCBsb29r
dXBfbmFtZT1uYW1lLAorICAgICAgICAgICAgdHJ5OgorICAgICAgICAgICAgICByYWlzZSBl
eGNfaW5mb1swXSwgZHRtbGV4YyhOb25lLCBOb25lLCBsb29rdXBfbmFtZT1uYW1lLAogICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9va3VwX3N0YWNrPWxvb2t1
cF9zdGFjaywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhv
ZF91cmw9bWV0aG9kX3VybCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgIG1ldGhvZF9uYW1lPW1ldGhvZF9uYW1lLApAQCAtMTg0LDYgKzE4NCw4IEBACiAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleGNfdmFsdWU9c3RyKGV4Y19p
bmZvWzFdKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4Y190
Yj1leGNfaW5mb1syXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICksIGV4Y19pbmZvWzJdCisgICAgICAgICAgICBleGNlcHQgZXhjX2luZm9bMF06IHJhaXNl
CisgICAgICAgICAgICBleGNlcHQ6IHJhaXNlIGV4Y19pbmZvWzBdLCBleGNfaW5mb1sxXSwg
ZXhjX2luZm9bMl0KICAgICAgICAgZWxzZToKICAgICAgICAgICAgIHJldHVybiBkdG1sZXhj
KE5vbmUsIE5vbmUsIGxvb2t1cF9uYW1lPW5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAg
ICAgICBsb29rdXBfc3RhY2s9bG9va3VwX3N0YWNrLAo=

--cgT1ZhECWA--