Re: [Zope-CMF] Effective Date inconsistencies
Previously Wichert Akkerman wrote: > Previously Alexander Limi wrote: > > Not so: > > > > - EffectiveDate returns a *string* 'None' when it has no value (wtf?) > > That is wrong: it should return 'the time in the system default > timezone' as documented in T Products.CMFCore.interfaces.IDublinCore. 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. Wichert. -- Wichert Akkerman <[EMAIL PROTECTED]>It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. ___ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests
Re: [Zope-CMF] Effective Date inconsistencies
Previously Alexander Limi wrote: > Not so: > > - EffectiveDate returns a *string* 'None' when it has no value (wtf?) That is wrong: it should return 'the time in the system default timezone' as documented in T Products.CMFCore.interfaces.IDublinCore. If Archetypes does that you should file a bugreport for it. > - Then I think "that's what 'effective' is for" — it return __FLOOR_DATE > if unset, so no False there either. ICatalogableDublinCore does not define what happens in that case, so __FLOOR_DATE is just as valid as anything else. > There seems to be no way of getting the effective date to actually return > a False value. How can a date ever be a boolean value? A data is a date. > 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? A 'False' value for a data can never be correct. Wichert. -- Wichert Akkerman <[EMAIL PROTECTED]>It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. ___ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests
Re: [Zope-CMF] Effective Date inconsistencies
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 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 -- Charlie Clark Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-938-5360 GSM: +49-178-782-6226 ___ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests
Re: [Zope-CMF] Effective Date inconsistencies
On 6/23/07, Alexander Limi <[EMAIL PROTECTED]> wrote: Not so: - EffectiveDate returns a *string* 'None' when it has no value (wtf?) 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. Maybe completely out of context, but have you verified this is a CMF 2.1 issue and not Archetypes? I know Archetypes overrides many of the methods from CMF, and it might get the corner cases like this wrong. -- Sidnei da Silva Enfold Systemshttp://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 ___ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests
[Zope-CMF] Effective Date inconsistencies
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? Published on […] Modified on […] 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 ___ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests