[Checkins] SVN: lovely.tag/branches/serverzen-z32-support/src/lovely/tag/ More Zope 3.2 compat fixes.

Rocky Burt rocky at serverzen.com
Wed May 16 13:12:54 EDT 2007


Log message for revision 75807:
  More Zope 3.2 compat fixes.

Changed:
  U   lovely.tag/branches/serverzen-z32-support/src/lovely/tag/README.txt
  U   lovely.tag/branches/serverzen-z32-support/src/lovely/tag/index.txt
  A   lovely.tag/branches/serverzen-z32-support/src/lovely/tag/testing.py

-=-
Modified: lovely.tag/branches/serverzen-z32-support/src/lovely/tag/README.txt
===================================================================
--- lovely.tag/branches/serverzen-z32-support/src/lovely/tag/README.txt	2007-05-16 15:11:49 UTC (rev 75806)
+++ lovely.tag/branches/serverzen-z32-support/src/lovely/tag/README.txt	2007-05-16 17:12:54 UTC (rev 75807)
@@ -25,7 +25,7 @@
 adapted to key references:
 
   >>> import zope.component
-  >>> from zope.app.keyreference import testing
+  >>> from lovely.tag import testing
 
   >>> zope.component.provideAdapter(testing.SimpleKeyReference)
 
@@ -573,7 +573,6 @@
   
 Let us setup the handler and events.
 
-  >>> from zope.component import eventtesting
   >>> from zope import event
   >>> from lovely.tag.engine import removeItemSubscriber
   >>> from zope.app.intid.interfaces import IntIdRemovedEvent

Modified: lovely.tag/branches/serverzen-z32-support/src/lovely/tag/index.txt
===================================================================
--- lovely.tag/branches/serverzen-z32-support/src/lovely/tag/index.txt	2007-05-16 15:11:49 UTC (rev 75806)
+++ lovely.tag/branches/serverzen-z32-support/src/lovely/tag/index.txt	2007-05-16 17:12:54 UTC (rev 75807)
@@ -25,7 +25,7 @@
   True
 
   >>> import zope.component
-  >>> from zope.app.keyreference import testing
+  >>> from lovely.tag import testing
   >>> zope.component.provideAdapter(testing.SimpleKeyReference)
 
   >>> engine.update(1, u'srichter', [u'USA', u'personal'])
@@ -53,20 +53,3 @@
   >>> sorted(namedIndex.apply({'any_of':['lovely']}))
   [4, 6]
 
-
-Use In A Catalog
-----------------
-
-  >>> from zope.app.catalog.catalog import Catalog
-  >>> cat = Catalog()
-  >>> cat['tags'] = index
-
-  >>> sorted(cat.apply({'tags':{'any_of':['lovely']}}))
-  [2, 4]
-
-  >>> cat['namedTags'] = namedIndex
-  >>> sorted(cat.apply({'tags':{'any_of':['lovely']},
-  ...                   'namedTags':{'any_of':['lovely']}
-  ...                  }))
-  [4]
-

Added: lovely.tag/branches/serverzen-z32-support/src/lovely/tag/testing.py
===================================================================
--- lovely.tag/branches/serverzen-z32-support/src/lovely/tag/testing.py	                        (rev 0)
+++ lovely.tag/branches/serverzen-z32-support/src/lovely/tag/testing.py	2007-05-16 17:12:54 UTC (rev 75807)
@@ -0,0 +1,26 @@
+import zope.interface
+import zope.component
+import zope.app.keyreference.interfaces
+
+class SimpleKeyReference(object):
+    """An IReference for all objects. This implementation is *not* ZODB safe.
+    """
+    zope.component.adapts(zope.interface.Interface)
+    zope.interface.implements(zope.app.keyreference.interfaces.IKeyReference)
+
+    key_type_id = 'zope.app.keyreference.simple'
+
+    def __init__(self, object):
+        self.object = object
+
+    def __call__(self):
+        return self.object
+
+    def __hash__(self):
+        return hash(self.object)
+
+    def __cmp__(self, other):
+        if self.key_type_id == other.key_type_id:
+            return cmp(hash(self.object), hash(other))
+
+        return cmp(self.key_type_id, other.key_type_id)



More information about the Checkins mailing list