[Zope-CMF] Re: Effective Date inconsistencies

Wichert Akkerman wichert at wiggy.net
Sat Jun 23 11:15:02 EDT 2007


Previously Laurence Rowe wrote:
> Maurits van Rees wrote:
> >Wichert Akkerman, on 2007-06-23:
> >>Previously Maurits van Rees wrote:
> >>>Wichert Akkerman, on 2007-06-23:
> >>>>I misread the interface; that only specified what should happen if no
> >>>>timezone is given. The interface says that the method should return a
> >>>>string which corresponds to the time or None if no time is set. So the
> >>>>behaviour you see is expected and can not be changed without breaking
> >>>>backwards compatibility.
> >>>Where are you reading that?  Products.CMFCore.interfaces.IDublinCore
> >>>only has some comments:
> >>Look at what interfaces/__init__.py does: it imports the interface from
> >>_content.py. DublinCore.py is a bbb stub.
> >
> >Ah, there. :)
> >
> >But that interface says:
> >
> >  Result is a string, formatted 'YYYY-MM-DD H24:MN:SS TZ', or None.
> >
> >I parse that as:
> >
> >  Result is (a string, formatted 'YYYY-MM-DD H24:MN:SS TZ',) or None.
> >
> >and not as:
> >
> >  Result is a string, formatted ('YYYY-MM-DD H24:MN:SS TZ' or 'None').
> >
> >Put simpler, I parse that as:
> >
> >  Result is a string or None.
> >
> >which seems just what Limi wants.
> >
> >In zope.dublincore that I quoted, the idea was that the result is a
> >formatted string or an empty string.  In other words, there it is
> >always a string, though it may be empty.  At least the boolean values
> >of the empty string and None are the same: False, as opposed to
> >bool('None') which is True.
> >
> >I am not sure where I am going with this line of reasoning :) but it
> >seems to me the zope.dublincore interface is slightly preferable,
> >always returning a string and still giving a good boolean value.
> >
> 
> How about changing EffectiveDate to:
> 
>         return ed and ed.toZone(zone).ISO() or ''
> 
> from the existing (as pointed out by Charlie):
> 
>         return ed and ed.toZone(zone).ISO() or 'None'
> 
> It would seem the least risky fix. (I'm not sure it's strictly a bug but 
> it struck me as completely brain dead when I was caught out by it).

We can't change it - people may rely on the current behaviour.

Wichert.

-- 
Wichert Akkerman <wichert at wiggy.net>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.


More information about the Zope-CMF mailing list