[Zope-CMF] Effective Date inconsistencies

Alexander Limi limi at plone.org
Sat Jun 23 05:18:25 EDT 2007


Hi,

I was trying to do a very simple template operation today:

1. Show the Effective Date if it is identical or more recent than the  
Modification Date

2. Show both Effective and Modification Dates if Modification Date >  
Effective Date

Should be simple, right?

<p tal:condition="context/EffectiveDate">
Published on […]
</p>

<p tal:condition="python: context.EffectiveDate() <  
context.ModificationDate()">
Modified on […]
</p>

Not so:

- EffectiveDate returns a *string* 'None' when it has no value (wtf?)

- Then I think "that's what 'effective' is for" — it return __FLOOR_DATE  
if unset, so no False there either.

There seems to be no way of getting the effective date to actually return  
a False value.

I am forced to crazy conditions like these:

tal:condition="python:context.EffectiveDate()!='None'">
and
tal:condition="python:context.EffectiveDate()!='None' and  
context.EffectiveDate() < context.ModificationDate()">

…and then Stefan says "I don't know whole story of your condition, you may  
need to use == and or or whatever, point being you have to guard for  
EffectiveDate being 'None'"

At which point I want to ask: Can we fix this in CMF 2.1, so it is  
possible to get False values from the date objects? The current situation  
seems pretty ridiculous. I might have missed it if there is a better way,  
but I couldn't find any.

-- 
Alexander Limi · http://limi.net



More information about the Zope-CMF mailing list