Re: Re-normalizers instead of ellipses in doctests [was: some checkin]

Marius Gedminas <[email protected]> Wed, 26 Sep 2007 18:20:11 -0400
Newsgroups gmane.comp.web.zope.zope3
Message-ID <20070926222011.GB10196@platonas>
On Wed, Sep 26, 2007 at 11:52:42PM +0200, Philipp von Weitershausen wrote:
> Marius Gedminas wrote:
>> Log message for revision 80145:
>>   Make the test pass on both Python 2.4 and 2.5.
>>   
> ...
>> -=-
>> Modified: z3c.form/trunk/src/z3c/form/action.txt
>> ===================================================================
>> --- z3c.form/trunk/src/z3c/form/action.txt	2007-09-26 21:26:25 UTC (rev 
>> 80144)
>> +++ z3c.form/trunk/src/z3c/form/action.txt	2007-09-26 21:49:09 UTC (rev 
>> 80145)
>> @@ -236,4 +236,5 @@
>>    <ActionErrorOccurred for <Action 'cancel' u'Cancel'>>
>>     >>> eventlog[-1].error
>> -  <ActionExecutionError wrapping <zope.interface.exceptions.Invalid ...>>
>> +  <ActionExecutionError wrapping ...Invalid...>
>> +
>
> It's too bad that Exception's __repr__ changed in Python 2.5.

Actually I like the new __repr__ better.

> The reason is 
> that it's a new-style class now, which is actually a benefit at the same 
> time.
>
> Anyway, these ellipses are very ugly and confusing.

I disagree.

> I think they're 
> okay-ish when you know exactly what they're supposed to stand for. In this 
> case we can definitely do better.

> When Nikhil N made all of zope.*'s tests pass on Python 2.5, he did a good 
> job of using re-normalizers. I very much suggest doing the same thing here. 
> I see you use a re-normalizer already for some messages, so I won't have to 
> show you how to use it :).

I actually tried using renormalizers for this, and hit a brick wall very
soon.  Renormalizers are ugly, confusing and essentially undebuggable.

    Some people, when confronted with a problem, think “I know, I’ll use
    regular expressions.” Now they have two problems.
            — Jamie Zawinski

Marius Gedminas
-- 
We're sysadmins. To us, data is a protocol-overhead.
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFG+tsbkVdEXeem148RAqmCAJ9n7n1XuBfjdIxX/IcolwP7T8cTBQCfVzm0
GxaWfBbmSd9h8aM6AAtbENE=
=uq0l
-----END PGP SIGNATURE-----