[Checkins] SVN: grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/ Move the order() directive back to grok. It's not of general use, it's really just for the viewlets

Philipp von Weitershausen philikon at philikon.de
Sun May 4 09:06:00 EDT 2008


Log message for revision 86361:
  Move the order() directive back to grok. It's not of general use, it's really just for the viewlets

Changed:
  U   grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/__init__.py
  U   grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/directive.py
  D   grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/tests/order/
  U   grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/tests/test_grok.py
  U   grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/util.py

-=-
Modified: grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/__init__.py
===================================================================
--- grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/__init__.py	2008-05-04 12:59:03 UTC (rev 86360)
+++ grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/__init__.py	2008-05-04 13:06:00 UTC (rev 86361)
@@ -22,7 +22,7 @@
 
 from martian import baseclass
 from grokcore.component.directive import (
-    context, name, title, description, provides, global_utility, direct, order)
+    context, name, title, description, provides, global_utility, direct)
 from grokcore.component.decorators import subscribe, adapter, implementer
 from martian.error import GrokError, GrokImportError
 

Modified: grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/directive.py
===================================================================
--- grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/directive.py	2008-05-04 12:59:03 UTC (rev 86360)
+++ grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/directive.py	2008-05-04 13:06:00 UTC (rev 86361)
@@ -46,17 +46,6 @@
             name = grokcore.component.name.get(factory)
         self.name = name
 
-class order(martian.Directive):
-    scope = martian.CLASS
-    store = martian.ONCE
-    default = 0, 0
-
-    _order = 0
-
-    def factory(self, value=0):
-        order._order += 1
-        return value, order._order
-
 class name(martian.Directive):
     scope = martian.CLASS
     store = martian.ONCE

Modified: grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/tests/test_grok.py
===================================================================
--- grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/tests/test_grok.py	2008-05-04 12:59:03 UTC (rev 86360)
+++ grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/tests/test_grok.py	2008-05-04 13:06:00 UTC (rev 86361)
@@ -45,7 +45,7 @@
 
 def test_suite():
     suite = unittest.TestSuite()
-    for name in ['adapter', 'directive', 'grokker', 'order', 'testsetup',
+    for name in ['adapter', 'directive', 'grokker', 'testsetup',
                  'utility', 'view', 'event']:
         suite.addTest(suiteFromPackage(name))
     return suite

Modified: grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/util.py
===================================================================
--- grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/util.py	2008-05-04 12:59:03 UTC (rev 86360)
+++ grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/util.py	2008-05-04 13:06:00 UTC (rev 86361)
@@ -14,23 +14,9 @@
 """Grok utility functions.
 """
 
-import grokcore.component
-from zope import component, interface
-
 from martian.error import GrokError
 from martian.util import methods_from_class, scan_for_classes
 
-def _sort_key(component):
-    explicit_order, implicit_order = grokcore.component.order.get(component)
-    return (explicit_order,
-            component.__module__,
-            implicit_order,
-            component.__class__.__name__)
-
-def sort_components(components):
-    # if components have a grok.order directive, sort by that
-    return sorted(components, key=_sort_key)
-
 AMBIGUOUS_COMPONENT = object()
 def check_module_component(factory, component, component_name, directive):
     """Raise error if module-level component cannot be determined.



More information about the Checkins mailing list