[Zope3-checkins] CVS: Zope3/src/zope/app/sqlscript/tests -
test_sqlscript.py:1.5
Stephan Richter
srichter at cosmos.phy.tufts.edu
Wed Mar 10 14:41:10 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/sqlscript/tests
In directory cvs.zope.org:/tmp/cvs-serv2886/src/zope/app/sqlscript/tests
Modified Files:
test_sqlscript.py
Log Message:
Removed the caching service. It was not providing much value anyways, so it was
easy.
Also, I updated the views in a way that SQL Script's chace support would work
again.
There is still much to do:
- zope.app.cache.caching does not have a formally defined API (interface)
- The CacheName field should be a vocabulary field.
- Views need to be updated to current form.
=== Zope3/src/zope/app/sqlscript/tests/test_sqlscript.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/sqlscript/tests/test_sqlscript.py:1.4 Tue Mar 2 08:48:30 2004
+++ Zope3/src/zope/app/sqlscript/tests/test_sqlscript.py Wed Mar 10 14:41:09 2004
@@ -32,7 +32,7 @@
from zope.app.interfaces.annotation import IAttributeAnnotatable
from zope.app.attributeannotations import AttributeAnnotations
-from zope.app.cache.interfaces import ICacheable, ICachingService
+from zope.app.cache.interfaces import ICacheable, ICache
from zope.app.cache.annotationcacheable import AnnotationCacheable
from zope.app.interfaces.traversing import IPhysicallyLocatable
from zope.app.interfaces.services.service import ISimpleService
@@ -91,7 +91,7 @@
class CacheStub:
-
+ implements(ICache)
def __init__(self):
self.cache = {}
@@ -110,16 +110,6 @@
return self.cache.get((obj, keywords), default)
-class CachingServiceStub:
-
- implements(ICachingService, ISimpleService)
-
- def __init__(self):
- self.caches = {}
-
- def getCache(self, name):
- return self.caches[name]
-
class LocatableStub:
implements(IPhysicallyLocatable)
@@ -143,18 +133,12 @@
ztapi.provideUtility(IZopeDatabaseAdapter, self.connectionUtilityStub,
'my_connection')
- self.caching_service = CachingServiceStub()
- sm.defineService('Caching', ICachingService)
- sm.provideService('Caching', self.caching_service)
- ztapi.provideAdapter(
- IAttributeAnnotatable, IAnnotations,
- AttributeAnnotations)
- ztapi.provideAdapter(
- ISQLScript, IPhysicallyLocatable,
- LocatableStub)
- ztapi.provideAdapter(
- IAnnotatable, ICacheable,
- AnnotationCacheable)
+ ztapi.provideAdapter(IAttributeAnnotatable, IAnnotations,
+ AttributeAnnotations)
+ ztapi.provideAdapter(ISQLScript, IPhysicallyLocatable,
+ LocatableStub)
+ ztapi.provideAdapter(IAnnotatable, ICacheable,
+ AnnotationCacheable)
def tearDown(self):
pass
@@ -219,7 +203,7 @@
self.assertEqual(result[0].counter, 2)
# caching: and check that the counter stays still
AnnotationCacheable(script).setCacheId('dumbcache')
- self.caching_service.caches['dumbcache'] = CacheStub()
+ ztapi.provideUtility(ICache, CacheStub(), 'dumbcache')
result = script(id=1)
self.assertEqual(result[0].counter, 3)
result = script(id=1)
More information about the Zope3-Checkins
mailing list