[Checkins] SVN: z3c.caching/trunk/src/z3c/caching/ Move ICacheRule implementation detail into registry.py to avoid it looking like an official API.
Martin Aspeli
optilude at gmx.net
Thu Dec 31 02:26:56 EST 2009
Log message for revision 107433:
Move ICacheRule implementation detail into registry.py to avoid it looking like an official API.
Changed:
U z3c.caching/trunk/src/z3c/caching/interfaces.py
U z3c.caching/trunk/src/z3c/caching/registry.py
-=-
Modified: z3c.caching/trunk/src/z3c/caching/interfaces.py
===================================================================
--- z3c.caching/trunk/src/z3c/caching/interfaces.py 2009-12-31 07:17:03 UTC (rev 107432)
+++ z3c.caching/trunk/src/z3c/caching/interfaces.py 2009-12-31 07:26:56 UTC (rev 107433)
@@ -1,4 +1,4 @@
-from zope.interface import Interface, Attribute
+from zope.interface import Interface
class IRulesetRegistry(Interface):
@@ -91,11 +91,3 @@
def __call__():
"""Return the last-modified date, as a Python datetime object.
"""
-
-class ICacheRule(Interface):
- """Represents the cache rule applied to an object.
-
- This is strictly an implementation detail of IRulesetRegistry.
- """
-
- id = Attribute("The identifier of this cache rule")
Modified: z3c.caching/trunk/src/z3c/caching/registry.py
===================================================================
--- z3c.caching/trunk/src/z3c/caching/registry.py 2009-12-31 07:17:03 UTC (rev 107432)
+++ z3c.caching/trunk/src/z3c/caching/registry.py 2009-12-31 07:26:56 UTC (rev 107433)
@@ -1,18 +1,29 @@
-""" Rulesets are registered for entities, which can be a type, an interface or
-even even a specific interface. This means the lookup mechanism needs to be
-aware of all of those and deal with things like derived classes as well.
-Luckily we have a framework which already implements that: zope.component.
+""" Rulesets are registered for entities, which can be a type or an interface.
+This means the lookup mechanism needs to be aware of all of those and deal
+with things like derived classes as well. Luckily we have a framework which
+already implements that: zope.component.
We will (ab)use the zope.component registries by registering a dummy adapter
for the entity to a special ICacheRule interface and which will always return
-the ruleset id. """
+the ruleset id.
+"""
+
import warnings
-from zope.interface import implements
+
+from zope.interface import implements, Interface, Attribute
+
from zope.component import adapts, getGlobalSiteManager
from zope.component.interfaces import IComponents
-from interfaces import ICacheRule, IRulesetRegistry
+from z3c.caching.interfaces import IRulesetRegistry
+class ICacheRule(Interface):
+ """Represents the cache rule applied to an object.
+ This is strictly an implementation detail of IRulesetRegistry.
+ """
+
+ id = Attribute("The identifier of this cache rule")
+
class CacheRule(object):
__slots__ = ("id")
implements(ICacheRule)
More information about the checkins
mailing list