[Checkins] SVN: zope.container/trunk/ 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.

Hanno Schlichting hannosch at hannosch.eu
Thu Dec 31 15:12:53 EST 2009


Log message for revision 107468:
  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.
  

Changed:
  U   zope.container/trunk/CHANGES.txt
  U   zope.container/trunk/setup.py
  U   zope.container/trunk/src/zope/container/btree.py
  U   zope.container/trunk/src/zope/container/constraints.py

-=-
Modified: zope.container/trunk/CHANGES.txt
===================================================================
--- zope.container/trunk/CHANGES.txt	2009-12-31 19:54:00 UTC (rev 107467)
+++ zope.container/trunk/CHANGES.txt	2009-12-31 20:12:53 UTC (rev 107468)
@@ -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)
 -------------------

Modified: zope.container/trunk/setup.py
===================================================================
--- zope.container/trunk/setup.py	2009-12-31 19:54:00 UTC (rev 107467)
+++ zope.container/trunk/setup.py	2009-12-31 20:12:53 UTC (rev 107468)
@@ -27,7 +27,7 @@
     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 at zope.org',
       description='Zope Container',
@@ -68,7 +68,6 @@
                 ]),
       install_requires=['setuptools',
                         'zope.interface',
-                        'zope.cachedescriptors',
                         'zope.dottedname',
                         'zope.schema',
                         'zope.component',

Modified: zope.container/trunk/src/zope/container/btree.py
===================================================================
--- zope.container/trunk/src/zope/container/btree.py	2009-12-31 19:54:00 UTC (rev 107467)
+++ zope.container/trunk/src/zope/container/btree.py	2009-12-31 20:12:53 UTC (rev 107468)
@@ -23,10 +23,29 @@
 
 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)

Modified: zope.container/trunk/src/zope/container/constraints.py
===================================================================
--- zope.container/trunk/src/zope/container/constraints.py	2009-12-31 19:54:00 UTC (rev 107467)
+++ zope.container/trunk/src/zope/container/constraints.py	2009-12-31 20:12:53 UTC (rev 107468)
@@ -153,7 +153,6 @@
 
 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 @@
 
     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):



More information about the checkins mailing list