[Checkins] SVN: zc.relationship/trunk/ Adjust more to new BTrees changes; document changes

Gary Poster gary at zope.com
Tue Feb 6 17:59:53 EST 2007


Log message for revision 72406:
  Adjust more to new BTrees changes; document changes
  
  

Changed:
  U   zc.relationship/trunk/CHANGES.txt
  U   zc.relationship/trunk/buildout.cfg
  U   zc.relationship/trunk/setup.py
  U   zc.relationship/trunk/src/zc/relationship/index.py

-=-
Modified: zc.relationship/trunk/CHANGES.txt
===================================================================
--- zc.relationship/trunk/CHANGES.txt	2007-02-06 19:03:40 UTC (rev 72405)
+++ zc.relationship/trunk/CHANGES.txt	2007-02-06 22:59:52 UTC (rev 72406)
@@ -2,9 +2,18 @@
 CHANGES
 =======
 
+1.1
+===
+
+(unreleased; supports Zope 3.4/Zope 2.11/ZODB 3.8, also unreleased)
+
+- adjust to BTrees changes in ZODB 3.8 (thanks Jürgen Kartnaller)
+
 1.0.1
 =====
 
+(supports Zope 3.3/Zope 2.10/ZODB 3.7)
+
 - Incorporated test and bug fix from Gabriel Shaar::
 
   if the target parameter is a container with no objects, then
@@ -19,4 +28,6 @@
 1.0
 ===
 
+(supports Zope 3.3/Zope 2.10/ZODB 3.7)
+
 Initial release

Modified: zc.relationship/trunk/buildout.cfg
===================================================================
--- zc.relationship/trunk/buildout.cfg	2007-02-06 19:03:40 UTC (rev 72405)
+++ zc.relationship/trunk/buildout.cfg	2007-02-06 22:59:52 UTC (rev 72406)
@@ -11,5 +11,5 @@
 
 [zope3]
 recipe = zc.recipe.zope3checkout
-url = svn://svn.zope.org/repos/main/Zope3/branches/3.3
+url = svn://svn.zope.org/repos/main/Zope3/trunk
 

Modified: zc.relationship/trunk/setup.py
===================================================================
--- zc.relationship/trunk/setup.py	2007-02-06 19:03:40 UTC (rev 72405)
+++ zc.relationship/trunk/setup.py	2007-02-06 22:59:52 UTC (rev 72406)
@@ -2,7 +2,7 @@
 
 setup(
     name="zc.relationship",
-    version="1.0.1",
+    version="1.1a",
     packages=find_packages('src'),
     include_package_data=True,
     package_dir= {'':'src'},
@@ -13,7 +13,9 @@
     author='Zope Project',
     author_email='zope3-dev at zope.org',
     description=open("README.txt").read(),
-    long_description=open("src/zc/relationship/README.txt").read(),
+    long_description=(
+        open('CHANGES.txt').read() + '\n========\nOverview\n========\n\n' +
+        open("src/zc/relationship/README.txt").read()),
     license='ZPL 2.1',
     keywords="zope zope3",
     )

Modified: zc.relationship/trunk/src/zc/relationship/index.py
===================================================================
--- zc.relationship/trunk/src/zc/relationship/index.py	2007-02-06 19:03:40 UTC (rev 72405)
+++ zc.relationship/trunk/src/zc/relationship/index.py	2007-02-06 22:59:52 UTC (rev 72406)
@@ -80,17 +80,10 @@
 # the relationship index
 
 def getModuleTools(module):
-    res = {'multiunion': None}
-    for nm in dir(module):
-        if not nm.startswith('_') and not nm.endswith('Iterator'):
-            value = getattr(module, nm)
-            if isinstance(value, types.ModuleType):
-                continue
-            if re.match('[A-Z][A-Z]', nm):
-                res[nm[2:]] = value
-            else:
-                res[nm] = value
-    return res
+    return dict(
+        (nm, getattr(module, nm, None)) for nm in 
+        ('BTree', 'TreeSet', 'Bucket', 'Set',
+         'intersection', 'multiunion', 'union', 'difference'))
 
 class Index(persistent.Persistent, zope.app.container.contained.Contained):
     interface.implements(interfaces.IIndex)
@@ -103,10 +96,10 @@
     def __init__(self, attrs, defaultTransitiveQueriesFactory=None,
                  dumpRel=generateToken, loadRel=resolveToken,
                  relFamily=IFBTree, deactivateSets=False):
-        self._name_TO_mapping = OOBTree.OOBTree()
+        self._name_TO_mapping = OOBTree.BTree()
         # held mappings are objtoken to (relcount, relset)
-        self._EMPTY_name_TO_relcount_relset = OOBTree.OOBTree()
-        self._reltoken_name_TO_objtokenset = OOBTree.OOBTree()
+        self._EMPTY_name_TO_relcount_relset = OOBTree.BTree()
+        self._reltoken_name_TO_objtokenset = OOBTree.BTree()
         self.defaultTransitiveQueriesFactory = defaultTransitiveQueriesFactory
         self._relTools = getModuleTools(relFamily)
         self._relTools['load'] = loadRel
@@ -142,10 +135,10 @@
             res['multiple'] = data.get('multiple', False)
             res['call'] = zope.interface.interfaces.IMethod.providedBy(val)
             if res['TreeSet'].__name__.startswith('I'):
-                Mapping = IOBTree.IOBTree
+                Mapping = IOBTree.BTree
             else:
                 assert res['TreeSet'].__name__.startswith('O')
-                Mapping = OOBTree.OOBTree
+                Mapping = OOBTree.BTree
             self._name_TO_mapping[res['name']] = Mapping()
             # these are objtoken to (relcount, relset)
 
@@ -304,7 +297,7 @@
             raise ValueError('one key in the primary query dictionary')
         (searchType, query) = query.items()[0]
         if searchType=='relationships':
-            if self._relTools['TreeSet'] is not IFBTree.IFTreeSet:
+            if self._relTools['TreeSet'] is not IFBTree.TreeSet:
                 raise ValueError(
                     'cannot fulfill `apply` interface because cannot return '
                     'an IFBTree-based result')
@@ -314,7 +307,7 @@
             return res
         elif searchType=='values':
             data = self._attrs[query['resultName']]
-            if data['TreeSet'] is not IFBTree.IFTreeSet:
+            if data['TreeSet'] is not IFBTree.TreeSet:
                 raise ValueError(
                     'cannot fulfill `apply` interface because cannot return '
                     'an IFBTree-based result')



More information about the Checkins mailing list