Commit b6433255 authored by Hanno Schlichting's avatar Hanno Schlichting

Copy two trivial classes from zope.cachedescriptors into this package, which...

Copy two trivial classes from zope.cachedescriptors into this package, which allows us to remove that dependency. We didn't actually use any caching properties as the dependency suggested.
parent 3d0d3bde
......@@ -2,9 +2,12 @@
CHANGES
=======
3.10.2 (unreleased)
3.11.0 (unreleased)
-------------------
- Copy two trivial classes from zope.cachedescriptors into this package, which
allows us to remove that dependency. We didn't actually use any caching
properties as the dependency suggested.
3.10.1 (2009-12-29)
-------------------
......
......@@ -27,7 +27,7 @@ def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(name='zope.container',
version = '3.10.2dev',
version = '3.11.0dev',
author='Zope Corporation and Contributors',
author_email='zope-dev@zope.org',
description='Zope Container',
......@@ -68,7 +68,6 @@ setup(name='zope.container',
]),
install_requires=['setuptools',
'zope.interface',
'zope.cachedescriptors',
'zope.dottedname',
'zope.schema',
'zope.component',
......
......@@ -23,10 +23,29 @@ from BTrees.Length import Length
from zope.container.interfaces import IBTreeContainer
from zope.container.contained import Contained, setitem, uncontained
from zope.cachedescriptors.property import Lazy
from zope.interface import implements
class Lazy(object):
"""Lazy Attributes.
"""
def __init__(self, func, name=None):
if name is None:
name = func.__name__
self.data = (func, name)
def __get__(self, inst, class_):
if inst is None:
return self
func, name = self.data
value = func(inst)
inst.__dict__[name] = value
return value
class BTreeContainer(Contained, Persistent):
implements(IBTreeContainer)
......
......@@ -153,7 +153,6 @@ __docformat__ = 'restructuredtext'
import sys
from zope.cachedescriptors.property import readproperty
from zope.dottedname.resolve import resolve
import zope.schema
from zope.interface import providedBy
......@@ -220,6 +219,20 @@ def checkFactory(container, name, factory):
return True
class readproperty(object):
def __init__(self, func):
self.func = func
def __get__(self, inst, class_):
if inst is None:
return self
func = self.func
return func(inst)
class IItemTypePrecondition(zope.interface.Interface):
def __call__(container, name, object):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment