[Checkins] SVN: grok/trunk/ Merge from
'philikon-ftest-layer-does-fixture-setup' branch:
Philipp von Weitershausen
philikon at philikon.de
Wed Aug 29 12:47:02 EDT 2007
Log message for revision 79364:
Merge from 'philikon-ftest-layer-does-fixture-setup' branch:
------------------------------------------------------------------------
r79224 | philikon | 2007-08-24 13:51:45 +0200 (Fri, 24 Aug 2007) | 11 lines
When we say <grok:grok package="foo" />, we can't do the grokking rightaway. We need to
emit an action first. Why? Consider this example:
<include package="that_registers_a_few_things_e.g_a_permission" />
<grok:grok package="that_refers_to_the_permission" />
The directives in the first package that's included are not executed until the actions
are executed. If we grok the 2nd package rightaway, grok won't see all the stuff that
the first package defined. Therefore, we need to step back in line and do grokking
during action-execution time.
------------------------------------------------------------------------
r79226 | philikon | 2007-08-24 13:56:14 +0200 (Fri, 24 Aug 2007) | 3 lines
ZCML emits a different error when things happen during action-execution time rather than
ZCML-parsing time.
Changed:
U grok/trunk/CHANGES.txt
U grok/trunk/src/grok/tests/zcml/directiveerror.py
U grok/trunk/src/grok/zcml.py
-=-
Modified: grok/trunk/CHANGES.txt
===================================================================
--- grok/trunk/CHANGES.txt 2007-08-29 16:09:44 UTC (rev 79363)
+++ grok/trunk/CHANGES.txt 2007-08-29 16:47:01 UTC (rev 79364)
@@ -12,6 +12,14 @@
* Add the grok.Role component base class.
+Restructuring
+-------------
+
+* The <grok:grok /> ZCML directive now emits a configuration action
+ instead of grokking right away at XML parsing time. That way
+ grokkers can depend on components that are set up using regular ZCML
+ (e.g. checking for a permission that's defined in ZCML).
+
0.10 (2007-08-21)
=================
Modified: grok/trunk/src/grok/tests/zcml/directiveerror.py
===================================================================
--- grok/trunk/src/grok/tests/zcml/directiveerror.py 2007-08-29 16:09:44 UTC (rev 79363)
+++ grok/trunk/src/grok/tests/zcml/directiveerror.py 2007-08-29 16:47:01 UTC (rev 79364)
@@ -14,9 +14,8 @@
... </configure>''', context=context)
Traceback (most recent call last):
...
- ZopeXMLConfigurationError: File "...", line ...
- GrokError: No module-level context for
- <class 'grok.tests.zcml.directiveerror.CavePainting'>, please use grok.context.
+ ConfigurationExecutionError: martian.error.GrokError: No module-level context for <class 'grok.tests.zcml.directiveerror.CavePainting'>, please use grok.context.
+ ...
"""
import grok
Modified: grok/trunk/src/grok/zcml.py
===================================================================
--- grok/trunk/src/grok/zcml.py 2007-08-29 16:09:44 UTC (rev 79363)
+++ grok/trunk/src/grok/zcml.py 2007-08-29 16:47:01 UTC (rev 79364)
@@ -30,4 +30,8 @@
def grokDirective(_context, package):
- grok.grok(package.__name__)
+ _context.action(
+ discriminator=('grok', package.__name__),
+ callable=grok.grok,
+ args=(package.__name__,)
+ )
More information about the Checkins
mailing list