[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/cache/ Removed
unused event support.
Jim Fulton
jim at zope.com
Sat May 22 05:40:22 EDT 2004
Log message for revision 24879:
Removed unused event support.
(If we need event support later, we'll do it differently.)
-=-
Modified: Zope3/trunk/src/zope/app/cache/interfaces/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/interfaces/__init__.py 2004-05-22 09:39:06 UTC (rev 24878)
+++ Zope3/trunk/src/zope/app/cache/interfaces/__init__.py 2004-05-22 09:40:21 UTC (rev 24879)
@@ -20,7 +20,6 @@
from zope.schema import TextLine
from zope.app import zapi
-from zope.app.event.interfaces import ISubscriber
# XXX: EEEEEEEEK, should be done using a vocabulary and the vocabulary field. :(
class CacheName(TextLine):
@@ -51,7 +50,7 @@
"""Sets the associated cache manager ID."""
-class ICache(ISubscriber):
+class ICache(Interface):
"""Interface for caches."""
def invalidate(ob, key=None):
Modified: Zope3/trunk/src/zope/app/cache/interfaces/ram.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/interfaces/ram.py 2004-05-22 09:39:06 UTC (rev 24878)
+++ Zope3/trunk/src/zope/app/cache/interfaces/ram.py 2004-05-22 09:40:21 UTC (rev 24879)
@@ -18,10 +18,9 @@
from zope.interface import Attribute
from zope.app.cache.interfaces import ICache
-from zope.app.event.interfaces import ISubscriber
from zope.app.registration.interfaces import IRegisterable
-class IRAMCache(ICache, ISubscriber, IRegisterable):
+class IRAMCache(ICache, IRegisterable):
"""Interface for the RAM Cache."""
maxEntries = Attribute("""A maximum number of cached values.""")
Modified: Zope3/trunk/src/zope/app/cache/ram.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/ram.py 2004-05-22 09:39:06 UTC (rev 24878)
+++ Zope3/trunk/src/zope/app/cache/ram.py 2004-05-22 09:40:21 UTC (rev 24879)
@@ -24,7 +24,6 @@
from zope.app import zapi
from zope.app.container.contained import Contained
from zope.app.cache.interfaces.ram import IRAMCache
-from zope.app.event.interfaces import IObjectModifiedEvent
# A global caches dictionary shared between threads
caches = {}
@@ -145,17 +144,7 @@
return ()
_buildKey = staticmethod(_buildKey)
- def notify(self, event):
- """See ISubscriber
- This method receives ObjectModified events and invalidates
- cached entries for the objects that raise them.
- """
-
- if IObjectModifiedEvent.providedBy(event):
- self._getStorage().invalidate(zapi.getPath(event.object))
-
-
class Storage:
"""Storage.
Modified: Zope3/trunk/src/zope/app/cache/tests/test_ramcache.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/tests/test_ramcache.py 2004-05-22 09:39:06 UTC (rev 24878)
+++ Zope3/trunk/src/zope/app/cache/tests/test_ramcache.py 2004-05-22 09:40:21 UTC (rev 24879)
@@ -25,7 +25,6 @@
from zope.app.cache.tests.test_icache import BaseICacheTest
from zope.app.cache.interfaces import ICache
from zope.app.cache.interfaces.ram import IRAMCache
-from zope.app.event.interfaces import ISubscriber
from zope.app.traversing.interfaces import IPhysicallyLocatable
from zope.app.tests.placelesssetup import PlacelessSetup
@@ -58,7 +57,6 @@
def test_interface(self):
verifyObject(IRAMCache, RAMCache())
verifyClass(ICache, RAMCache)
- verifyClass(ISubscriber, RAMCache)
def test_init(self):
from zope.app.cache.ram import RAMCache
@@ -204,34 +202,7 @@
# Try something that's not there
c.invalidate(('yadda',))
- def test_notify(self):
- from zope.app.cache.ram import RAMCache
- from zope.app.event.objectevent import ObjectModifiedEvent, ObjectEvent
- from zope.app.event.interfaces import IEvent
- class DummyEvent:
- implements(IEvent)
-
- location = ('aaa',)
- ob = Locatable(path=location)
- keywords = {"answer": 42}
- value = "true"
- c = RAMCache()
- key = RAMCache._buildKey(keywords)
- c._getStorage().setEntry(location, key, value)
-
- c.notify(DummyEvent())
- self.assertEquals(c._getStorage().getEntry(location, key),
- value, "doesn't ignore uninteresting events")
-
- c.notify(ObjectEvent(ob))
- self.assertEquals(c._getStorage().getEntry(location, key),
- value, "doesn't ignore uninteresting events")
-
- c.notify(ObjectModifiedEvent(ob))
- self.assertRaises(KeyError, c._getStorage().getEntry, location, key)
-
-
class TestStorage(TestCase):
def test_getEntry(self):
More information about the Zope3-Checkins
mailing list