[Zope-CVS] CVS: Products/Ape/lib/apelib/zope2 - classifier.py:1.4

Shane Hathaway shane@zope.com
Wed, 30 Jul 2003 17:33:23 -0400


Update of /cvs-repository/Products/Ape/lib/apelib/zope2
In directory cvs.zope.org:/tmp/cvs-serv5368/lib/apelib/zope2

Modified Files:
	classifier.py 
Log Message:
Merged ape-scan-branch, sneaking in interface updates and minor reformatting.

Ape now watches the filesystem for changes to objects that Zope has in its
cache.


=== Products/Ape/lib/apelib/zope2/classifier.py 1.3 => 1.4 ===
--- Products/Ape/lib/apelib/zope2/classifier.py:1.3	Wed Jul  9 11:40:15 2003
+++ Products/Ape/lib/apelib/zope2/classifier.py	Wed Jul 30 17:33:17 2003
@@ -21,7 +21,7 @@
 from Acquisition import aq_base
 from OFS.ObjectManager import ObjectManager
 
-from apelib.core.interfaces import IClassifier
+from apelib.core.interfaces import IConfigurableClassifier
 from apelib.core.exceptions import SerializationError, DeserializationError
 
 # guess_extension() is useful, but it's unoptimized and sometimes
@@ -42,7 +42,7 @@
 class Classifier:
     """A classifier with some minimal Zope 2 extensions.
     """
-    __implements__ = IClassifier
+    __implements__ = IConfigurableClassifier
 
 
     def __init__(self, gw=None):
@@ -57,19 +57,20 @@
         return self.gw
 
 
-    def register(self, attr, value, mapper_name):
-        if attr == 'key':
+    def register(self, condition, value, mapper_name):
+        if condition == 'key':
             self.key_to_mapper[value] = mapper_name
-        elif attr == 'extension':
+        elif condition == 'extension':
             self.ext_to_mapper[value] = mapper_name
-        elif attr == 'class':
+        elif condition == 'class':
             self.class_to_mapper[value] = mapper_name
-        elif attr == 'fallback':
+        elif condition == 'fallback':
             assert value in ('directory', 'file',
                              'folderish_object', 'fileish_object'), value
             self.fallback_to_mapper[value] = mapper_name
         else:
-            raise ValueError('Unknown attr: %s' % attr)
+            raise ValueError('Unknown classification condition: %s'
+                             % repr(condition))
 
 
     def setOption(self, mapper_name, option, value):