[Zope-Checkins] CVS: Releases/Zope/lib/python/TAL/tests - test_htmltalparser.py:1.33.2.1

Evan Simpson evan at 4-am.com
Fri Aug 29 15:15:39 EDT 2003


Update of /cvs-repository/Releases/Zope/lib/python/TAL/tests
In directory cvs.zope.org:/tmp/cvs-serv25364/lib/python/TAL/tests

Modified Files:
      Tag: evan-pathprefix-branch
	test_htmltalparser.py 
Log Message:
Added the ability to define prefixes using tal:define="prefix name expr".
Expression types for the prefix namespace are *not* the same as normal
TALES expression types.  There are only two: 'builtin' and 'ext'.
'builtin' allows the built-in prefix types to be renamed, and 'ext'
(for 'external' and/or 'extension') allows access to additional
prefix types defined by trusted code.  An example of this is
"ext:PageTemplates.NumericConversions", defined in "ExtSample.py".

The convention I'm trying to establish is that 'ext' prefix types
use names of the form "<Product>.<Descriptive Name>".

In order to accomodate this new facility, I had to defer the compilation
step for prefixed path segments until they are evaluated.  The compiled
segment is cached, and reused if the mapping from local prefix name to
prefix type doesn't change (which it usually won't).



=== Releases/Zope/lib/python/TAL/tests/test_htmltalparser.py 1.33 => 1.33.2.1 ===
--- Releases/Zope/lib/python/TAL/tests/test_htmltalparser.py:1.33	Tue Jul 22 09:28:46 2003
+++ Releases/Zope/lib/python/TAL/tests/test_htmltalparser.py	Fri Aug 29 14:15:38 2003
@@ -296,6 +296,18 @@
             rawtext('</p>'),
             ])
 
+    def check_define_7(self):
+        self._run_check(
+            "<p tal:define='prefix v builtin:var'></p>", [
+            ('setPosition', (1, 0)),
+            ('beginScope', {'tal:define': 'prefix v builtin:var'}),
+            ('setPrefix', ('v', 'builtin:var')),
+            ('startTag', ('p',
+             [('tal:define', 'prefix v builtin:var', 'tal')])),
+            ('endScope', ()),
+            rawtext('</p>'),
+            ])
+
     def check_condition(self):
         self._run_check(
             "<p><span tal:condition='python:1'><b>foo</b></span></p>", [




More information about the Zope-Checkins mailing list