[Checkins] SVN: grokcore.view/branches/sylvain-template-inheritance-fix/src/grokcore/view/meta/ use order numbers high enough to make it improbable we are running out of component headroom. comment cosmetics.

Jan-Wijbrand Kolman janwijbrand at gmail.com
Mon Jan 31 07:45:31 EST 2011


Log message for revision 120020:
  use order numbers high enough to make it improbable we are running out of component headroom. comment cosmetics.

Changed:
  U   grokcore.view/branches/sylvain-template-inheritance-fix/src/grokcore/view/meta/templates.py
  U   grokcore.view/branches/sylvain-template-inheritance-fix/src/grokcore/view/meta/views.py

-=-
Modified: grokcore.view/branches/sylvain-template-inheritance-fix/src/grokcore/view/meta/templates.py
===================================================================
--- grokcore.view/branches/sylvain-template-inheritance-fix/src/grokcore/view/meta/templates.py	2011-01-31 10:59:53 UTC (rev 120019)
+++ grokcore.view/branches/sylvain-template-inheritance-fix/src/grokcore/view/meta/templates.py	2011-01-31 12:45:30 UTC (rev 120020)
@@ -12,7 +12,7 @@
 #
 ##############################################################################
 """Grokkers for templates."""
-
+import sys
 import martian
 
 from grokcore.view import components
@@ -25,8 +25,8 @@
     martian.priority(1000)
 
     def grok(self, name, instance, module_info, config, **kw):
-        # We set order to 0, to be sure to register templates
-        # first.
+        # We set the configuration action order to 0, to be sure to
+        # register templates first.
         config.action(
             discriminator=None,
             callable=templatereg.register_inline_template,
@@ -40,14 +40,14 @@
 
 
 class FilesystemPageTemplateGrokker(martian.GlobalGrokker):
-    # do this early on, but after ModulePageTemplateGrokker, as
-    # findFilesystem depends on module-level templates to be
-    # already grokked for error reporting
+    # Do this early on, but after ModulePageTemplateGrokker, as
+    # findFilesystem depends on module-level templates to be already
+    # grokked for error reporting.
     martian.priority(999)
 
     def grok(self, name, module, module_info, config, **kw):
-        # We set order to 0, to be sure to register templates
-        # first.
+        # We set the configuration action order to 0, to be sure to
+        # register templates first.
         config.action(
             discriminator=None,
             callable=templatereg.register_directory,
@@ -65,13 +65,13 @@
     def grok(self, name, module, module_info, config, **kw):
         if not self._action_registered:
             self._action_registered = True
-            # We set order to 10000 to be sure to check unused
-            # template at the end only.
+            # We set the configuration action order to very very high
+            # to be sure to check unused template at the end only.
             config.action(
                 discriminator=None,
                 callable=templatereg.check_unassociated,
                 args=(),
-                order=10000
+                order=sys.maxint
                 )
         return True
 

Modified: grokcore.view/branches/sylvain-template-inheritance-fix/src/grokcore/view/meta/views.py
===================================================================
--- grokcore.view/branches/sylvain-template-inheritance-fix/src/grokcore/view/meta/views.py	2011-01-31 10:59:53 UTC (rev 120019)
+++ grokcore.view/branches/sylvain-template-inheritance-fix/src/grokcore/view/meta/views.py	2011-01-31 12:45:30 UTC (rev 120020)
@@ -12,6 +12,7 @@
 #
 ##############################################################################
 """Grokkers for the views code."""
+import sys
 
 from zope import interface, component
 from zope.publisher.interfaces.browser import IDefaultBrowserLayer
@@ -34,7 +35,7 @@
 class TemplateGrokker(martian.ClassGrokker):
     martian.baseclass()
 
-    _template_order = 5000
+    _template_order = sys.maxint/2
 
     def grok(self, name, factory, module_info, **kw):
         # Need to store the module info to look for a template
@@ -42,19 +43,19 @@
         return super(TemplateGrokker, self).grok(name, factory, module_info, **kw)
 
     def execute(self, factory, config, **kw):
-        # Associate templates to a view or a component. We set order
-        # to at least 5000, to do it after all templates have be
-        # registered to the shared template registry, and yet before
-        # unassociated templates are checked.
+        # Associate templates to a view or a component. We set the
+        # configuration action order to a number quite high, to do it
+        # after all templates have be registered to the shared template
+        # registry, and yet before unassociated templates are checked.
         config.action(
             discriminator=None,
             callable=self.associate_template,
             args=(factory.module_info, factory),
             order=self._template_order)
-        # We increase _template_order to keep a relative order of
-        # association between each different Grok extensions. (Like
-        # this an implicit template can be inherited between two
-        # different Grok extensions.)
+        # We increase _template_order to maintain the relative order of
+        # template association between the different Grok extensions
+        # (like an implicit template can be inherited between two
+        # different Grok extensions).
         self._template_order += 1
         return True
 



More information about the checkins mailing list