[z3-checkins] r54964 - in z3/deliverance/trunk: . deliverance deliverance/test-data
ianb at codespeak.net
ianb at codespeak.net
Mon May 19 23:02:14 CEST 2008
Author: ianb
Date: Mon May 19 23:02:11 2008
New Revision: 54964
Modified:
z3/deliverance/trunk/CHANGES.txt
z3/deliverance/trunk/deliverance/interpreter.py
z3/deliverance/trunk/deliverance/test-data/test_move.xml
z3/deliverance/trunk/deliverance/xslt.py
Log:
Run all rules in order (previously drop and move rules ran before other rules; deprecate the XSLT renderer, which could not implement in-order rules
Modified: z3/deliverance/trunk/CHANGES.txt
==============================================================================
--- z3/deliverance/trunk/CHANGES.txt (original)
+++ z3/deliverance/trunk/CHANGES.txt Mon May 19 23:02:11 2008
@@ -25,6 +25,14 @@
- (setup) Relax restriction on lxml 2.x (which should work fine).
+- (interpreter) Run the rules in order, including running drop rules
+ in order (previously they were always run before all other rules)
+ and run move="1" rules in order with all the other rules.
+
+- Deprecate the XSLT interpreter. Changing rules to run in order was
+ not feasible with the XSLT version, but the intuitive behavior was
+ more important than the alternate renderer.
+
0.1.2 (2008-02-19)
------------------
Modified: z3/deliverance/trunk/deliverance/interpreter.py
==============================================================================
--- z3/deliverance/trunk/deliverance/interpreter.py (original)
+++ z3/deliverance/trunk/deliverance/interpreter.py Mon May 19 23:02:11 2008
@@ -78,22 +78,9 @@
rules, theme and content should be lxml etree
structures.
"""
- drop_rules, other_rules = self.separate_drop_rules(rules)
- move_rules, other_rules = self.separate_move_rules(other_rules)
-
- # process all drop rules first
- for rule in drop_rules:
- self.apply_rule(rule, theme, content)
-
- # process all move rules next
- for rule in move_rules:
- self.apply_rule(rule,theme,content)
-
- # finally the rest
- for rule in other_rules:
+ for rule in rules:
self.apply_rule(rule, theme, content)
-
def apply_rule(self, rule, theme, content):
"""
calls proper rule application function for
Modified: z3/deliverance/trunk/deliverance/test-data/test_move.xml
==============================================================================
--- z3/deliverance/trunk/deliverance/test-data/test_move.xml (original)
+++ z3/deliverance/trunk/deliverance/test-data/test_move.xml Mon May 19 23:02:11 2008
@@ -5,8 +5,8 @@
<deliverance-test>
<rules xmlns="http://www.plone.org/deliverance">
- <copy theme="//div[@id='content']" content="//*[@id='body']" />
<copy theme="//div[@id='nav']" content="//*[@id='extra_nav']" move="1" />
+ <copy theme="//div[@id='content']" content="//*[@id='body']" />
</rules>
<theme base="http://example.com">
@@ -98,8 +98,8 @@
<!-- tests move with append -->
<deliverance-test>
<rules xmlns="http://www.plone.org/deliverance">
- <copy theme="//div[@id='content']" content="//*[@id='body']" />
<append theme="//div[@id='nav']" content="//*[@id='extra_nav']" move="1" />
+ <copy theme="//div[@id='content']" content="//*[@id='body']" />
</rules>
<theme base="http://example.com">
@@ -142,8 +142,8 @@
<!-- tests move with prepend -->
<deliverance-test>
<rules xmlns="http://www.plone.org/deliverance">
- <copy theme="//div[@id='content']" content="//*[@id='body']" />
<prepend theme="//div[@id='nav']" content="//*[@id='extra_nav']" move="1" />
+ <copy theme="//div[@id='content']" content="//*[@id='body']" />
</rules>
<theme base="http://example.com">
Modified: z3/deliverance/trunk/deliverance/xslt.py
==============================================================================
--- z3/deliverance/trunk/deliverance/xslt.py (original)
+++ z3/deliverance/trunk/deliverance/xslt.py Mon May 19 23:02:11 2008
@@ -67,6 +67,8 @@
before being returned.
"""
+ import warnings
+ warnings.warn("The XSLT renderer is deprecated; please use deliverance.interpreter.Renderer instead. The XSLT renderer may produce different results than the Python renderer", DeprecationWarning)
theme_copy = copy.deepcopy(theme)
self.rules = rule
self.rules_uri = rule_uri
More information about the z3-checkins
mailing list