[Checkins] SVN: grok/trunk/src/grok/components.py - refactored priority attribute into a common base class

Christian Theune ct at gocept.com
Fri Jan 5 12:09:59 EST 2007


Log message for revision 71719:
   - refactored priority attribute into a common base class
  

Changed:
  U   grok/trunk/src/grok/components.py

-=-
Modified: grok/trunk/src/grok/components.py
===================================================================
--- grok/trunk/src/grok/components.py	2007-01-05 17:09:06 UTC (rev 71718)
+++ grok/trunk/src/grok/components.py	2007-01-05 17:09:58 UTC (rev 71719)
@@ -46,27 +46,31 @@
 
 from grok import util, security, interfaces
 
-class ClassGrokker(object):
+
+class GrokkerBase(object):
+    """A common base class for all grokkers.
+    """
+
+    priority = 0
+
+
+class ClassGrokker(GrokkerBase):
     """Grokker for particular classes in a module.
     """
     # subclasses should have a component_class class variable
 
-    priority = 0
-    
     def match(self, obj):
         return util.check_subclass(obj, self.component_class)
-    
+
     def register(self, context, name, factory, module_info, templates):
         raise NotImplementedError
 
 
-class InstanceGrokker(object):
+class InstanceGrokker(GrokkerBase):
     """Grokker for particular instances in a module.
     """
     # subclasses should have a component_class class variable
 
-    priority = 0
-    
     def match(self, obj):
         return isinstance(obj, self.component_class)
    
@@ -74,10 +78,9 @@
         raise NotImplementedError
 
 
-class ModuleGrokker(object):
+class ModuleGrokker(GrokkerBase):
     """Grokker that gets executed once for a module.
     """
-    priority = 0
 
     def match(self, obj):
         # we never match with any object



More information about the Checkins mailing list