[Checkins] SVN: grok/branches/jw-philipp-using-ndir-directives/src/grok/components.py Don't hardcode the allowed directives, just allow any directive value to be set on the index object.

Philipp von Weitershausen philikon at philikon.de
Sat May 3 10:33:16 EDT 2008


Log message for revision 86221:
  Don't hardcode the allowed directives, just allow any directive value to be set on the index object.

Changed:
  U   grok/branches/jw-philipp-using-ndir-directives/src/grok/components.py

-=-
Modified: grok/branches/jw-philipp-using-ndir-directives/src/grok/components.py
===================================================================
--- grok/branches/jw-philipp-using-ndir-directives/src/grok/components.py	2008-05-03 14:32:46 UTC (rev 86220)
+++ grok/branches/jw-philipp-using-ndir-directives/src/grok/components.py	2008-05-03 14:33:16 UTC (rev 86221)
@@ -621,15 +621,13 @@
     def __init__(self, name, bases=(), attrs=None):
         if attrs is None:
             return
-        # make sure we take over a bunch of possible attributes
-        for name in ['__grok_context__', '__grok_name__',
-                     '__grok_site__']:
-            value = attrs.get(name)
-            if value is not None:
-                setattr(self, name, value)
-        # now read and store indexes
         indexes = {}
         for name, value in attrs.items():
+            # Ignore everything that's not an index definition object
+            # except for values set by directives
+            if '.' in name:
+                setattr(self, name, value)
+                continue
             if not interfaces.IIndexDefinition.providedBy(value):
                 continue
             indexes[name] = value



More information about the Checkins mailing list