[Checkins] SVN: grokcore.component/trunk/ Moved directives 'path' from grokcore.view and 'order' from grokcore.viewlet to this package.

Souheil CHELFOUH souheil at chelfouh.com
Sun Jan 3 07:18:38 EST 2010


Log message for revision 107582:
  Moved directives 'path' from grokcore.view and 'order' from grokcore.viewlet to this package.
  We still need to adapt grokcore.viewlet and grokcore.view to import from here. We should maybe first release grokcore.component and go from there.
  

Changed:
  U   grokcore.component/trunk/CHANGES.txt
  U   grokcore.component/trunk/src/grokcore/component/__init__.py
  U   grokcore.component/trunk/src/grokcore/component/directive.py

-=-
Modified: grokcore.component/trunk/CHANGES.txt
===================================================================
--- grokcore.component/trunk/CHANGES.txt	2010-01-03 11:29:50 UTC (rev 107581)
+++ grokcore.component/trunk/CHANGES.txt	2010-01-03 12:18:37 UTC (rev 107582)
@@ -4,9 +4,12 @@
 2.1 (unreleased)
 ----------------
 
-- Tiny dependency adjustment: moved zope.event to test dependencies.
+* Moved directives 'order' from grokcore.viewlet and 'path' from
+  grokcore.view to this very package. 
 
+* Tiny dependency adjustment: moved zope.event to test dependencies.
 
+
 2.0 (2009-09-16)
 ----------------
 

Modified: grokcore.component/trunk/src/grokcore/component/__init__.py
===================================================================
--- grokcore.component/trunk/src/grokcore/component/__init__.py	2010-01-03 11:29:50 UTC (rev 107581)
+++ grokcore.component/trunk/src/grokcore/component/__init__.py	2010-01-03 12:18:37 UTC (rev 107582)
@@ -14,18 +14,23 @@
 """Grok
 """
 
+from zope.component import adapts
 from zope.interface import implements, implementsOnly, classProvides
-from zope.component import adapts
 
+from martian import baseclass
+from martian.error import GrokError, GrokImportError
 from martian import ClassGrokker, InstanceGrokker, GlobalGrokker
-from grokcore.component.components import Adapter, GlobalUtility, MultiAdapter, Context
 
-from martian import baseclass
+from grokcore.component.components import (
+    Adapter, GlobalUtility, MultiAdapter, Context)
+
 from grokcore.component.directive import (
-    context, name, title, description, provides, global_utility, global_adapter, direct)
-from grokcore.component.decorators import subscribe, adapter, implementer, provider
-from martian.error import GrokError, GrokImportError
+    context, description, direct, name, order, path, provides, title,
+    global_utility, global_adapter)
 
+from grokcore.component.decorators import (
+    subscribe, adapter, implementer, provider)
+
 # Import this module so that it's available as soon as you import the
 # 'grokcore.component' package.  Useful for tests and interpreter examples.
 import grokcore.component.testing

Modified: grokcore.component/trunk/src/grokcore/component/directive.py
===================================================================
--- grokcore.component/trunk/src/grokcore/component/directive.py	2010-01-03 11:29:50 UTC (rev 107581)
+++ grokcore.component/trunk/src/grokcore/component/directive.py	2010-01-03 12:18:37 UTC (rev 107582)
@@ -14,10 +14,10 @@
 """Grok directives.
 """
 import martian
-import grokcore.component
 from zope.interface.interfaces import IInterface
 from martian.error import GrokImportError
 
+
 class global_utility(martian.MultipleTimesDirective):
     scope = martian.MODULE
 
@@ -65,6 +65,22 @@
 class direct(martian.MarkerDirective):
     scope = martian.CLASS
 
+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 path(martian.Directive):
+    scope = martian.CLASS
+    store = martian.ONCE
+    validate = martian.validateText
+
 class provides(martian.Directive):
     scope = martian.CLASS
     store = martian.ONCE



More information about the checkins mailing list