[Zope3-dev] Re: zope3 doesn't like the python datetime module?

Jim Fulton jim at zope.com
Mon Sep 22 16:13:40 EDT 2003


Anthony Baxter wrote:
> When trying to use zope.interface outside Zope, without the src/datetime
> package, tests fail with:
> 
>   File "test.py", line 487, in get_suite
>     mod = package_import(modname)
>   File "test.py", line 479, in package_import
>     mod = __import__(modname)
>   File "zope/interface/common/tests/test_idatetime.py", line 22, in ?
>     from zope.interface.common.idatetime import ITimeDelta, ITimeDeltaClass
>   File "zope/interface/common/idatetime.py", line 574, in ?
>     directlyProvides(timedelta, ITimeDeltaClass)
>   File "zope/interface/declarations.py", line 969, in directlyProvides
>     object.__provides__ = ProvidesSpecification(*interfaces)
> TypeError: can't set attributes of built-in/extension type 'datetime.timedelta'
> 
> This makes me sad. Can anyone suggest a fix? 

Someone was trying to declare an interface for a class to document
the fact that the datetime classes implement interfaces beyond just
object construction. This is a reasonable thing to do. unfortunately,
this isn't possible for builtin types, which are immutable.

I've commeted out these declarations for now.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (703) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org





More information about the Zope3-dev mailing list