[Zope-CMF] DateTime attribute error in one CMF instance but not another

Sylvain Thénault Sylvain.Thenault at logilab.fr
Fri Nov 28 01:51:10 EST 2003


On Thursday 27 November à 11:07, Anton Hughes wrote:
> Hi All,
> 
> I've got a funny error with a filesystem python script calling DateTime.
> Here is the relevant part of the code (it's lifted from PloneChat, which I'm
> hacking to run on a CMFDefault portal):
> 
> from DateTime import DateTime
> 
> dt_date = DateTime(chat_date)
> 
> Module ZPublisher.Publish, line 98, in publish
> Module ZPublisher.mapply, line 88, in mapply
> Module ZPublisher.Publish, line 39, in call_object
> Module Products.CMFCore.FSPythonScript, line 92, in __call__
> Module Shared.DC.Scripts.Bindings, line 252, in __call__
> Module Shared.DC.Scripts.Bindings, line 283, in _bindAndExec
> Module Products.CMFCore.FSPythonScript, line 126, in _exec
> __traceback_info__: ({'script': <FSPythonScript at
> /courses/LTPortalChat_edit used for /courses/chat>, 'context': <LTPortalChat
> at /courses/chat>, 'container': <CMFSite instance at a830be8>,
> 'traverse_subpath': []}, ('', None, None, None, 0), {}, ('', None, None,
> None, 0))
> Module Script (Python), line 14, in LTPortalChat_edit
> Module DateTime.DateTime, line 1302, in year
> Module DateTime.DateTime, line 1056, in __getattr__
> AttributeError: _year

DateTime doesn't like None value :

>>> from DateTime import DateTime
>>> DateTime(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "DateTime/DateTime.py", line 1557, in __repr__
    return '%s(\'%s\')' % (self.__class__.__name__,str(self))
  File "DateTime/DateTime.py", line 1561, in __str__
    y,m,d   =self._year,self._month,self._day
  File "DateTime/DateTime.py", line 1056, in __getattr__
    raise AttributeError, name
AttributeError: _year

-- 
Sylvain Thénault                               LOGILAB, Paris (France).

http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org




More information about the Zope-CMF mailing list