[Checkins] SVN: zc.relationship/trunk/src/zc/relationship/ After other projects told me that the default behavior was annoying, I finally experienced it myself. Changed so that the default tokenizer uses the thread site context rather than the index as context.

Gary Poster gary at zope.com
Sat Jul 15 15:48:34 EDT 2006


Log message for revision 69141:
  After other projects told me that the default behavior was annoying, I finally experienced it myself.  Changed so that the default tokenizer uses the thread site context rather than the index as context.
  

Changed:
  U   zc.relationship/trunk/src/zc/relationship/index.py
  U   zc.relationship/trunk/src/zc/relationship/tests.py

-=-
Modified: zc.relationship/trunk/src/zc/relationship/index.py
===================================================================
--- zc.relationship/trunk/src/zc/relationship/index.py	2006-07-15 11:46:46 UTC (rev 69140)
+++ zc.relationship/trunk/src/zc/relationship/index.py	2006-07-15 19:48:34 UTC (rev 69141)
@@ -67,15 +67,13 @@
 def generateToken(obj, index, cache):
     intids = cache.get('intids')
     if intids is None:
-        intids = cache['intids'] = component.getUtility(
-            IIntIds, context=index)
+        intids = cache['intids'] = component.getUtility(IIntIds)
     return intids.register(obj)
 
 def resolveToken(token, index, cache):
     intids = cache.get('intids')
     if intids is None:
-        intids = cache['intids'] = component.getUtility(
-            IIntIds, context=index)
+        intids = cache['intids'] = component.getUtility(IIntIds)
     return intids.getObject(token)
 
 ##############################################################################

Modified: zc.relationship/trunk/src/zc/relationship/tests.py
===================================================================
--- zc.relationship/trunk/src/zc/relationship/tests.py	2006-07-15 11:46:46 UTC (rev 69140)
+++ zc.relationship/trunk/src/zc/relationship/tests.py	2006-07-15 19:48:34 UTC (rev 69141)
@@ -62,6 +62,8 @@
     test.globs['root'] = root = conn.root()
     test.globs['app'] = app = root['app'] = rootFolder()
     app.setSiteManager(LocalSiteManager(app))
+    zope.app.component.hooks.setSite(app)
+    zope.app.component.hooks.setHooks()
     for i in range(30):
         id = 'ob%d' % i
         app[id] = Demo(id)
@@ -81,6 +83,8 @@
     test.globs['Relationship'] = shared.Relationship
 
 def tearDown(test):
+    zope.app.component.hooks.resetHooks()
+    zope.app.component.hooks.setSite()
     transaction.abort()
     test.globs['db'].close()
     placelesssetup.tearDown()



More information about the Checkins mailing list