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

Marius Gedminas mgedmin at b4net.lt
Wed Sep 26 18:20:11 EDT 2007


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20070926/b3a7a98f/attachment.bin


More information about the Zope3-dev mailing list