[Zope-CMF] Effective Date inconsistencies

Charlie Clark charlie at begeistert.org
Sat Jun 23 05:55:51 EDT 2007

Am 23.06.2007 um 11:18 schrieb Alexander Limi:

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

What would you rather have? An attribute error?

This is the implementation from CMFDefault.DublinCore

     def EffectiveDate( self, zone=None ):
         """ Dublin Core Date element - date resource becomes effective.
         if zone is None:
             zone = _zone
         ed = getattr( self, 'effective_date', None )
         return ed and ed.toZone(zone).ISO() or 'None'

     def ModificationDate( self, zone=None ):
         """ Dublin Core Date element - date resource last modified.
         if zone is None:
             zone = _zone
         return self.modified().toZone(zone).ISO()

If you wish to overwrite this in your content types then fine but I  
think returning 'None' as a string is a correct because  
ModificationDate also returns a string. If you wish to compare the  
values you need to access context.effective and context_modified

<tal:test tal:condition="python: context.effective() <  
context.modified()" />

Not that I don't think some of this stuff couldn't be cleaned up: you  
have to convert any of these dates back into objects to  
internationalise them in templates!


Charlie Clark
Helmholtzstr. 20
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226

More information about the Zope-CMF mailing list