From casey at zope.com Thu Jul 3 17:45:05 2003 From: casey at zope.com (Casey Duncan) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/ZTUtils - Zope.py:1.12 Message-ID: <200307032145.h63Lj5F24727@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/ZTUtils In directory cvs.zope.org:/tmp/cvs-serv24688 Modified Files: Zope.py Log Message: Add missing return statement === Zope/lib/python/ZTUtils/Zope.py 1.11 => 1.12 === --- Zope/lib/python/ZTUtils/Zope.py:1.11 Mon Oct 7 15:43:15 2002 +++ Zope/lib/python/ZTUtils/Zope.py Thu Jul 3 17:44:59 2003 @@ -102,6 +102,7 @@ def filterChildren(self, children): if self._values_filter: return self._values_filter(LazyFilter(children, skip=self.skip)) + return children class TreeMaker(TreeSkipMixin, TreeMaker): _getChildren = TreeMaker.getChildren From andreas at andreas-jung.com Sun Jul 6 06:44:33 2003 From: andreas at andreas-jung.com (Andreas Jung) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/Products/PageTemplates - ZopePageTemplate.py:1.45 Message-ID: <200307061044.h66AiXu08418@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/Products/PageTemplates In directory cvs.zope.org:/tmp/cvs-serv8091/lib/python/Products/PageTemplates Modified Files: ZopePageTemplate.py Log Message: - Collector #628: Applied patch to fix several textarea resize problems. === Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py 1.44 => 1.45 === --- Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py:1.44 Wed Sep 18 11:12:46 2002 +++ Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py Sun Jul 6 06:43:56 2003 @@ -138,33 +138,25 @@ return self.pt_editForm(manage_tabs_message=message) def pt_changePrefs(self, REQUEST, height=None, width=None, - dtpref_cols='100%', dtpref_rows='20'): + dtpref_cols="100%", dtpref_rows="20"): """Change editing preferences.""" - szchh = {'Taller': 1, 'Shorter': -1, None: 0} - szchw = {'Wider': 5, 'Narrower': -5, None: 0} - - # The From andreas at andreas-jung.com Sun Jul 6 06:48:04 2003 From: andreas at andreas-jung.com (Andreas Jung) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/Products/PageTemplates - ZopePageTemplate.py:1.44.44.1 Message-ID: <200307061048.h66Am4q09114@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/Products/PageTemplates In directory cvs.zope.org:/tmp/cvs-serv8776/lib/python/Products/PageTemplates Modified Files: Tag: Zope-2_7-branch ZopePageTemplate.py Log Message: - Collector #628: Applied patch to fix several textarea resize problems. === Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py 1.44 => 1.44.44.1 === --- Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py:1.44 Wed Sep 18 11:12:46 2002 +++ Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py Sun Jul 6 06:47:30 2003 @@ -138,33 +138,25 @@ return self.pt_editForm(manage_tabs_message=message) def pt_changePrefs(self, REQUEST, height=None, width=None, - dtpref_cols='100%', dtpref_rows='20'): + dtpref_cols="100%", dtpref_rows="20"): """Change editing preferences.""" - szchh = {'Taller': 1, 'Shorter': -1, None: 0} - szchw = {'Wider': 5, 'Narrower': -5, None: 0} - - # The From fred at zope.com Wed Jul 9 13:25:14 2003 From: fred at zope.com (Fred L. Drake, Jr.) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/Products/PageTemplates/tests/input - CheckPathAlt.html:1.4 Message-ID: <200307091725.h69HPEO22410@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/Products/PageTemplates/tests/input In directory cvs.zope.org:/tmp/cvs-serv22371 Modified Files: CheckPathAlt.html Log Message: Access the key that was looked up in a way that will result in the same output for both Python 2.2 and 2.3. Python 2.3 changes the str() of KeyError exceptions to return a repr() of the key instead of the str() of the key, which caused quotes to be generated if we don't pick out just the key. === Zope/lib/python/Products/PageTemplates/tests/input/CheckPathAlt.html 1.3 => 1.4 === --- Zope/lib/python/Products/PageTemplates/tests/input/CheckPathAlt.html:1.3 Thu Dec 13 13:37:50 2001 +++ Zope/lib/python/Products/PageTemplates/tests/input/CheckPathAlt.html Wed Jul 9 13:25:07 2003 @@ -15,7 +15,7 @@

Z

Z

-

Z

+

Z

From mj at zope.com Tue Jul 15 13:02:02 2003 From: mj at zope.com (Martijn Pieters) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/ZTUtils - Tree.py:1.16 Message-ID: <200307151702.h6FH22T21687@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/ZTUtils In directory cvs.zope.org:/tmp/cvs-serv21595/lib/python/ZTUtils Modified Files: Tree.py Log Message: Fix potential problem with step being an empty string (later on the code refers to 'if len(step) == 0'). === Zope/lib/python/ZTUtils/Tree.py 1.15 => 1.16 === --- Zope/lib/python/ZTUtils/Tree.py:1.15 Fri Apr 25 12:32:02 2003 +++ Zope/lib/python/ZTUtils/Tree.py Tue Jul 15 13:01:56 2003 @@ -295,7 +295,7 @@ if nth is not None: nth_pair = (None, None) for step in s.split(':'): - if step[0] == '_': + if step.startswith('_'): pop = len(step) - 1 continue if pop < 0: From mj at zope.com Tue Jul 15 13:03:30 2003 From: mj at zope.com (Martijn Pieters) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/ZTUtils - Tree.py:1.15.2.1 Message-ID: <200307151703.h6FH3UY21945@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/ZTUtils In directory cvs.zope.org:/tmp/cvs-serv21825/lib/python/ZTUtils Modified Files: Tag: Zope-2_7-branch Tree.py Log Message: Merge from head; fix potential problem with step being an empty string. === Zope/lib/python/ZTUtils/Tree.py 1.15 => 1.15.2.1 === --- Zope/lib/python/ZTUtils/Tree.py:1.15 Fri Apr 25 12:32:02 2003 +++ Zope/lib/python/ZTUtils/Tree.py Tue Jul 15 13:03:22 2003 @@ -295,7 +295,7 @@ if nth is not None: nth_pair = (None, None) for step in s.split(':'): - if step[0] == '_': + if step.startswith('_'): pop = len(step) - 1 continue if pop < 0: From mj at zope.com Tue Jul 15 13:05:52 2003 From: mj at zope.com (Martijn Pieters) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/ZTUtils - Tree.py:1.6.6.9 Message-ID: <200307151705.h6FH5qM22342@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/ZTUtils In directory cvs.zope.org:/tmp/cvs-serv22278/lib/python/ZTUtils Modified Files: Tag: Zope-2_6-branch Tree.py Log Message: Merge from head; fix potential problem with step being an empty string. === Zope/lib/python/ZTUtils/Tree.py 1.6.6.8 => 1.6.6.9 === --- Zope/lib/python/ZTUtils/Tree.py:1.6.6.8 Fri Apr 25 12:31:41 2003 +++ Zope/lib/python/ZTUtils/Tree.py Tue Jul 15 13:05:47 2003 @@ -295,7 +295,7 @@ if nth is not None: nth_pair = (None, None) for step in s.split(':'): - if step[0] == '_': + if step.startswith('_'): pop = len(step) - 1 continue if pop < 0: From fred at zope.com Fri Jul 18 11:06:15 2003 From: fred at zope.com (Fred L. Drake, Jr.) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/Products/PageTemplates/tests/input - CheckPathAlt.html:1.3.80.1 Message-ID: <200307181506.h6IF6FG07370@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/Products/PageTemplates/tests/input In directory cvs.zope.org:/tmp/cvs-serv7330 Modified Files: Tag: Zope-2_6-branch CheckPathAlt.html Log Message: backport fix for Python 2.3 compatibility nit === Zope/lib/python/Products/PageTemplates/tests/input/CheckPathAlt.html 1.3 => 1.3.80.1 === --- Zope/lib/python/Products/PageTemplates/tests/input/CheckPathAlt.html:1.3 Thu Dec 13 13:37:50 2001 +++ Zope/lib/python/Products/PageTemplates/tests/input/CheckPathAlt.html Fri Jul 18 11:06:09 2003 @@ -15,7 +15,7 @@

Z

Z

-

Z

+

Z

From chrism at zope.com Mon Jul 21 12:39:01 2003 From: chrism at zope.com (Chris McDonough) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/Products/PageTemplates - ZopePageTemplate.py:1.44.44.2 Message-ID: <200307211639.h6LGd1i18943@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/Products/PageTemplates In directory cvs.zope.org:/tmp/cvs-serv17213/lib/python/Products/PageTemplates Modified Files: Tag: Zope-2_7-branch ZopePageTemplate.py Log Message: Merge changes from HEAD since the release of Zope 2.7a1 into the Zope-2_7-branch in preparation for release of Zope 2.7b1. === Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py 1.44.44.1 => 1.44.44.2 === From chrism at zope.com Mon Jul 21 12:39:20 2003 From: chrism at zope.com (Chris McDonough) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/ZTUtils - Tree.py:1.15.2.2 Zope.py:1.11.42.1 Message-ID: <200307211639.h6LGdK319169@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/ZTUtils In directory cvs.zope.org:/tmp/cvs-serv17213/lib/python/ZTUtils Modified Files: Tag: Zope-2_7-branch Tree.py Zope.py Log Message: Merge changes from HEAD since the release of Zope 2.7a1 into the Zope-2_7-branch in preparation for release of Zope 2.7b1. === Zope/lib/python/ZTUtils/Tree.py 1.15.2.1 => 1.15.2.2 === === Zope/lib/python/ZTUtils/Zope.py 1.11 => 1.11.42.1 === --- Zope/lib/python/ZTUtils/Zope.py:1.11 Mon Oct 7 15:43:15 2002 +++ Zope/lib/python/ZTUtils/Zope.py Mon Jul 21 12:37:40 2003 @@ -102,6 +102,7 @@ def filterChildren(self, children): if self._values_filter: return self._values_filter(LazyFilter(children, skip=self.skip)) + return children class TreeMaker(TreeSkipMixin, TreeMaker): _getChildren = TreeMaker.getChildren From chrism at zope.com Mon Jul 21 12:39:05 2003 From: chrism at zope.com (Chris McDonough) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/Products/PageTemplates/tests/input - CheckPathAlt.html:1.3.142.1 Message-ID: <200307211639.h6LGd5W18993@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/Products/PageTemplates/tests/input In directory cvs.zope.org:/tmp/cvs-serv17213/lib/python/Products/PageTemplates/tests/input Modified Files: Tag: Zope-2_7-branch CheckPathAlt.html Log Message: Merge changes from HEAD since the release of Zope 2.7a1 into the Zope-2_7-branch in preparation for release of Zope 2.7b1. === Zope/lib/python/Products/PageTemplates/tests/input/CheckPathAlt.html 1.3 => 1.3.142.1 === --- Zope/lib/python/Products/PageTemplates/tests/input/CheckPathAlt.html:1.3 Thu Dec 13 13:37:50 2001 +++ Zope/lib/python/Products/PageTemplates/tests/input/CheckPathAlt.html Mon Jul 21 12:35:59 2003 @@ -15,7 +15,7 @@

Z

Z

-

Z

+

Z

From gotcha at swing.be Tue Jul 22 09:29:26 2003 From: gotcha at swing.be (Godefroid Chapelle) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL/tests/input - test19.html:1.2 test20.html:1.2 Message-ID: <200307221329.h6MDTQY31164@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL/tests/input In directory cvs.zope.org:/tmp/cvs-serv30718/tests/input Added Files: test19.html test20.html Log Message: deny attributes being both part of tal:attributes and having a messageid in i18n:attributes === Zope/lib/python/TAL/tests/input/test19.html 1.1 => 1.2 === --- /dev/null Tue Jul 22 09:29:26 2003 +++ Zope/lib/python/TAL/tests/input/test19.html Tue Jul 22 09:28:50 2003 @@ -0,0 +1,9 @@ + + + + + === Zope/lib/python/TAL/tests/input/test20.html 1.1 => 1.2 === --- /dev/null Tue Jul 22 09:29:26 2003 +++ Zope/lib/python/TAL/tests/input/test20.html Tue Jul 22 09:28:50 2003 @@ -0,0 +1 @@ + From gotcha at swing.be Tue Jul 22 09:29:23 2003 From: gotcha at swing.be (Godefroid Chapelle) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL/tests - test_htmltalparser.py:1.33 Message-ID: <200307221329.h6MDTNZ31149@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL/tests In directory cvs.zope.org:/tmp/cvs-serv30718/tests Modified Files: test_htmltalparser.py Log Message: deny attributes being both part of tal:attributes and having a messageid in i18n:attributes === Zope/lib/python/TAL/tests/test_htmltalparser.py 1.32 => 1.33 === --- Zope/lib/python/TAL/tests/test_htmltalparser.py:1.32 Fri Apr 25 14:06:56 2003 +++ Zope/lib/python/TAL/tests/test_htmltalparser.py Tue Jul 22 09:28:46 2003 @@ -511,6 +511,9 @@ ('bar', None, 'insert', None, 1, None)])), ('endScope', ()), ]) + self._should_error('''''') def test_i18n_name_bad_name(self): self._should_error("") From gotcha at swing.be Tue Jul 22 09:29:20 2003 From: gotcha at swing.be (Godefroid Chapelle) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL - TALGenerator.py:1.64 Message-ID: <200307221329.h6MDTKR31135@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL In directory cvs.zope.org:/tmp/cvs-serv30718 Modified Files: TALGenerator.py Log Message: deny attributes being both part of tal:attributes and having a messageid in i18n:attributes === Zope/lib/python/TAL/TALGenerator.py 1.63 => 1.64 === --- Zope/lib/python/TAL/TALGenerator.py:1.63 Mon Apr 7 13:38:27 2003 +++ Zope/lib/python/TAL/TALGenerator.py Tue Jul 22 09:28:43 2003 @@ -664,6 +664,11 @@ # Convert repldict's name-->expr mapping to a # name-->(compiled_expr, translate) mapping for key, value in repldict.items(): + if i18nattrs.get(key, None): + raise I18NError( + ("attribute [%s] cannot both be part of tal:attributes" + + " and have a msgid in i18n:attributes") % key, + position) ce = self.compileExpression(value) repldict[key] = ce, key in i18nattrs, i18nattrs.get(key) for key in i18nattrs: From gotcha at swing.be Tue Jul 22 09:29:00 2003 From: gotcha at swing.be (Godefroid Chapelle) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL/tests/output - test19.html:1.2 test20.html:1.2 Message-ID: <200307221329.h6MDT0331070@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL/tests/output In directory cvs.zope.org:/tmp/cvs-serv30718/tests/output Added Files: test19.html test20.html Log Message: deny attributes being both part of tal:attributes and having a messageid in i18n:attributes === Zope/lib/python/TAL/tests/output/test19.html 1.1 => 1.2 === --- /dev/null Tue Jul 22 09:29:00 2003 +++ Zope/lib/python/TAL/tests/output/test19.html Tue Jul 22 09:28:53 2003 @@ -0,0 +1,5 @@ + + + + + === Zope/lib/python/TAL/tests/output/test20.html 1.1 => 1.2 === --- /dev/null Tue Jul 22 09:29:00 2003 +++ Zope/lib/python/TAL/tests/output/test20.html Tue Jul 22 09:28:53 2003 @@ -0,0 +1 @@ + From gotcha at swing.be Tue Jul 22 10:52:29 2003 From: gotcha at swing.be (Godefroid Chapelle) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL/tests/input - test19.html:1.2.2.1 test20.html:1.2.2.1 Message-ID: <200307221452.h6MEqTX11762@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL/tests/input In directory cvs.zope.org:/tmp/cvs-serv11616/tests/input Added Files: Tag: Zope-2_7-branch test19.html test20.html Log Message: deny attributes being both part of tal:attributes and having a messageid in i18n:attributes === Added File Zope/lib/python/TAL/tests/input/test19.html === === Added File Zope/lib/python/TAL/tests/input/test20.html === From gotcha at swing.be Tue Jul 22 10:52:33 2003 From: gotcha at swing.be (Godefroid Chapelle) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL/tests/output - test19.html:1.2.2.1 test20.html:1.2.2.1 Message-ID: <200307221452.h6MEqX111782@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL/tests/output In directory cvs.zope.org:/tmp/cvs-serv11616/tests/output Added Files: Tag: Zope-2_7-branch test19.html test20.html Log Message: deny attributes being both part of tal:attributes and having a messageid in i18n:attributes === Added File Zope/lib/python/TAL/tests/output/test19.html === === Added File Zope/lib/python/TAL/tests/output/test20.html === From gotcha at swing.be Tue Jul 22 10:52:53 2003 From: gotcha at swing.be (Godefroid Chapelle) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL - TALGenerator.py:1.63.4.1 Message-ID: <200307221452.h6MEqra11841@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL In directory cvs.zope.org:/tmp/cvs-serv11616 Modified Files: Tag: Zope-2_7-branch TALGenerator.py Log Message: deny attributes being both part of tal:attributes and having a messageid in i18n:attributes === Zope/lib/python/TAL/TALGenerator.py 1.63 => 1.63.4.1 === --- Zope/lib/python/TAL/TALGenerator.py:1.63 Mon Apr 7 13:38:27 2003 +++ Zope/lib/python/TAL/TALGenerator.py Tue Jul 22 10:52:18 2003 @@ -664,6 +664,11 @@ # Convert repldict's name-->expr mapping to a # name-->(compiled_expr, translate) mapping for key, value in repldict.items(): + if i18nattrs.get(key, None): + raise I18NError( + ("attribute [%s] cannot both be part of tal:attributes" + + " and have a msgid in i18n:attributes") % key, + position) ce = self.compileExpression(value) repldict[key] = ce, key in i18nattrs, i18nattrs.get(key) for key in i18nattrs: From gotcha at swing.be Tue Jul 22 10:52:56 2003 From: gotcha at swing.be (Godefroid Chapelle) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL/tests - test_htmltalparser.py:1.32.2.1 Message-ID: <200307221452.h6MEquS11849@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL/tests In directory cvs.zope.org:/tmp/cvs-serv11616/tests Modified Files: Tag: Zope-2_7-branch test_htmltalparser.py Log Message: deny attributes being both part of tal:attributes and having a messageid in i18n:attributes === Zope/lib/python/TAL/tests/test_htmltalparser.py 1.32 => 1.32.2.1 === --- Zope/lib/python/TAL/tests/test_htmltalparser.py:1.32 Fri Apr 25 14:06:56 2003 +++ Zope/lib/python/TAL/tests/test_htmltalparser.py Tue Jul 22 10:52:21 2003 @@ -511,6 +511,9 @@ ('bar', None, 'insert', None, 1, None)])), ('endScope', ()), ]) + self._should_error('''''') def test_i18n_name_bad_name(self): self._should_error("") From gotcha at swing.be Fri Jul 25 12:15:05 2003 From: gotcha at swing.be (Godefroid Chapelle) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL/tests/output - test19.html:1.2.2.2 Message-ID: <200307251615.h6PGF5c21063@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL/tests/output In directory cvs.zope.org:/tmp/cvs-serv20543/tests/output Modified Files: Tag: Zope-2_7-branch test19.html Log Message: backward compatibility for i18n:attributes if items are separated with spaces and there are more than two items, all are treated as attributes plus deprecation warning if items are separated with spaces and there are two items : - i18n:attributes="value msg_id;" (with semicolon) will always be treated as - i18n:attributes="value title" will be treated as as long as title exist as attribute (both as static or in tal:attributes) plus deprecation warning === Zope/lib/python/TAL/tests/output/test19.html 1.2.2.1 => 1.2.2.2 === --- Zope/lib/python/TAL/tests/output/test19.html:1.2.2.1 Tue Jul 22 10:52:26 2003 +++ Zope/lib/python/TAL/tests/output/test19.html Fri Jul 25 12:14:58 2003 @@ -3,3 +3,12 @@ + + + + + + + + + From gotcha at swing.be Fri Jul 25 12:15:28 2003 From: gotcha at swing.be (Godefroid Chapelle) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL - TALGenerator.py:1.63.4.2 Message-ID: <200307251615.h6PGFS821136@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL In directory cvs.zope.org:/tmp/cvs-serv20543 Modified Files: Tag: Zope-2_7-branch TALGenerator.py Log Message: backward compatibility for i18n:attributes if items are separated with spaces and there are more than two items, all are treated as attributes plus deprecation warning if items are separated with spaces and there are two items : - i18n:attributes="value msg_id;" (with semicolon) will always be treated as - i18n:attributes="value title" will be treated as as long as title exist as attribute (both as static or in tal:attributes) plus deprecation warning === Zope/lib/python/TAL/TALGenerator.py 1.63.4.1 => 1.63.4.2 === --- Zope/lib/python/TAL/TALGenerator.py:1.63.4.1 Tue Jul 22 10:52:18 2003 +++ Zope/lib/python/TAL/TALGenerator.py Fri Jul 25 12:14:53 2003 @@ -657,7 +657,7 @@ else: repldict = {} if i18nattrs: - i18nattrs = _parseI18nAttributes(i18nattrs, self.position, + i18nattrs = _parseI18nAttributes(i18nattrs, attrlist, repldict, self.position, self.xml) else: i18nattrs = {} @@ -796,27 +796,52 @@ self.emitDefineMacro(defineMacro) -def _parseI18nAttributes(i18nattrs, position, xml): +def _parseI18nAttributes(i18nattrs, attrlist, repldict, position, xml): d = {} - for spec in i18nattrs.split(";"): - parts = spec.split() - if len(parts) > 2: - raise TALError("illegal i18n:attributes specification: %r" % spec, - position) - if len(parts) == 2: - attr, msgid = parts - else: - # len(parts) == 1 - attr = parts[0] - msgid = None - if not xml: - attr = attr.lower() - if attr in d: - raise TALError( - "attribute may only be specified once in i18n:attributes: %r" - % attr, - position) - d[attr] = msgid + if ';' in i18nattrs: + i18nattrlist = i18nattrs.split(';') + i18nattrlist = [attr.strip().split() for attr in i18nattrlist if attr.strip()] + for parts in i18nattrlist: + if len(parts) > 2: + raise TALError("illegal i18n:attributes specification: %r" % spec, + position) + if len(parts) == 2: + attr, msgid = parts + else: + # len(parts) == 1 + attr = parts[0] + msgid = None + if not xml: + attr = attr.lower() + if attr in d: + raise TALError( + "attribute may only be specified once in i18n:attributes: %r" + % attr, + position) + d[attr] = msgid + else: + i18nattrlist = i18nattrs.split() + if len(i18nattrlist) == 2: + staticattrs = [attr[0] for attr in attrlist if len(attr) == 2] + if (not i18nattrlist[1] in staticattrs) and (not i18nattrlist[1] in repldict): + attr, msgid = i18nattrlist + d[attr] = msgid + else: + import warnings + warnings.warn('Space separated attributes in i18n:attributes' + + ' are deprecated (i18n:attributes="value title"). Please use' + + ' semicolon to separate attributes' + + ' (i18n:attributes="value; title").', DeprecationWarning) + for attr in i18nattrlist: + d[attr] = None + else: + import warnings + warnings.warn('Space separated attributes in i18n:attributes' + + ' are deprecated (i18n:attributes="value title"). Please use' + + ' semicolon to separate attributes' + + ' (i18n:attributes="value; title").', DeprecationWarning) + for attr in i18nattrlist: + d[attr] = None return d def test(): From gotcha at swing.be Fri Jul 25 12:15:30 2003 From: gotcha at swing.be (Godefroid Chapelle) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL/tests/input - test19.html:1.2.2.2 Message-ID: <200307251615.h6PGFU021150@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL/tests/input In directory cvs.zope.org:/tmp/cvs-serv20543/tests/input Modified Files: Tag: Zope-2_7-branch test19.html Log Message: backward compatibility for i18n:attributes if items are separated with spaces and there are more than two items, all are treated as attributes plus deprecation warning if items are separated with spaces and there are two items : - i18n:attributes="value msg_id;" (with semicolon) will always be treated as - i18n:attributes="value title" will be treated as as long as title exist as attribute (both as static or in tal:attributes) plus deprecation warning === Zope/lib/python/TAL/tests/input/test19.html 1.2.2.1 => 1.2.2.2 === --- Zope/lib/python/TAL/tests/input/test19.html:1.2.2.1 Tue Jul 22 10:52:22 2003 +++ Zope/lib/python/TAL/tests/input/test19.html Fri Jul 25 12:14:56 2003 @@ -7,3 +7,16 @@ + + + + + + + + + From chrism at zope.com Fri Jul 25 14:54:48 2003 From: chrism at zope.com (Chris McDonough) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL/tests/output - test19.html:1.3 Message-ID: <200307251854.h6PIsmP15617@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL/tests/output In directory cvs.zope.org:/tmp/cvs-serv15492/lib/python/TAL/tests/output Modified Files: test19.html Log Message: Merge TAL i18n fixes which break CMF to HEAD from 2.7 branch. === Zope/lib/python/TAL/tests/output/test19.html 1.2 => 1.3 === --- Zope/lib/python/TAL/tests/output/test19.html:1.2 Tue Jul 22 09:28:53 2003 +++ Zope/lib/python/TAL/tests/output/test19.html Fri Jul 25 14:54:42 2003 @@ -3,3 +3,12 @@ + + + + + + + + + From chrism at zope.com Fri Jul 25 14:55:13 2003 From: chrism at zope.com (Chris McDonough) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL - TALGenerator.py:1.65 Message-ID: <200307251855.h6PItDk15675@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL In directory cvs.zope.org:/tmp/cvs-serv15492/lib/python/TAL Modified Files: TALGenerator.py Log Message: Merge TAL i18n fixes which break CMF to HEAD from 2.7 branch. === Zope/lib/python/TAL/TALGenerator.py 1.64 => 1.65 === --- Zope/lib/python/TAL/TALGenerator.py:1.64 Tue Jul 22 09:28:43 2003 +++ Zope/lib/python/TAL/TALGenerator.py Fri Jul 25 14:54:36 2003 @@ -657,7 +657,7 @@ else: repldict = {} if i18nattrs: - i18nattrs = _parseI18nAttributes(i18nattrs, self.position, + i18nattrs = _parseI18nAttributes(i18nattrs, attrlist, repldict, self.position, self.xml) else: i18nattrs = {} @@ -796,27 +796,52 @@ self.emitDefineMacro(defineMacro) -def _parseI18nAttributes(i18nattrs, position, xml): +def _parseI18nAttributes(i18nattrs, attrlist, repldict, position, xml): d = {} - for spec in i18nattrs.split(";"): - parts = spec.split() - if len(parts) > 2: - raise TALError("illegal i18n:attributes specification: %r" % spec, - position) - if len(parts) == 2: - attr, msgid = parts - else: - # len(parts) == 1 - attr = parts[0] - msgid = None - if not xml: - attr = attr.lower() - if attr in d: - raise TALError( - "attribute may only be specified once in i18n:attributes: %r" - % attr, - position) - d[attr] = msgid + if ';' in i18nattrs: + i18nattrlist = i18nattrs.split(';') + i18nattrlist = [attr.strip().split() for attr in i18nattrlist if attr.strip()] + for parts in i18nattrlist: + if len(parts) > 2: + raise TALError("illegal i18n:attributes specification: %r" % spec, + position) + if len(parts) == 2: + attr, msgid = parts + else: + # len(parts) == 1 + attr = parts[0] + msgid = None + if not xml: + attr = attr.lower() + if attr in d: + raise TALError( + "attribute may only be specified once in i18n:attributes: %r" + % attr, + position) + d[attr] = msgid + else: + i18nattrlist = i18nattrs.split() + if len(i18nattrlist) == 2: + staticattrs = [attr[0] for attr in attrlist if len(attr) == 2] + if (not i18nattrlist[1] in staticattrs) and (not i18nattrlist[1] in repldict): + attr, msgid = i18nattrlist + d[attr] = msgid + else: + import warnings + warnings.warn('Space separated attributes in i18n:attributes' + + ' are deprecated (i18n:attributes="value title"). Please use' + + ' semicolon to separate attributes' + + ' (i18n:attributes="value; title").', DeprecationWarning) + for attr in i18nattrlist: + d[attr] = None + else: + import warnings + warnings.warn('Space separated attributes in i18n:attributes' + + ' are deprecated (i18n:attributes="value title"). Please use' + + ' semicolon to separate attributes' + + ' (i18n:attributes="value; title").', DeprecationWarning) + for attr in i18nattrlist: + d[attr] = None return d def test(): From chrism at zope.com Fri Jul 25 14:55:15 2003 From: chrism at zope.com (Chris McDonough) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL/tests/input - test19.html:1.3 Message-ID: <200307251855.h6PItFp15689@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL/tests/input In directory cvs.zope.org:/tmp/cvs-serv15492/lib/python/TAL/tests/input Modified Files: test19.html Log Message: Merge TAL i18n fixes which break CMF to HEAD from 2.7 branch. === Zope/lib/python/TAL/tests/input/test19.html 1.2 => 1.3 === --- Zope/lib/python/TAL/tests/input/test19.html:1.2 Tue Jul 22 09:28:50 2003 +++ Zope/lib/python/TAL/tests/input/test19.html Fri Jul 25 14:54:39 2003 @@ -7,3 +7,16 @@ + + + + + + + + + From evan at 4-am.com Tue Jul 29 15:55:50 2003 From: evan at 4-am.com (Evan Simpson) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Releases/Zope/lib/python/Products/PageTemplates - PathPrefixes.py:1.1.2.1 Expressions.py:1.43.46.1 Message-ID: <200307291955.h6TJtoU16699@cvs.baymountain.com> Update of /cvs-repository/Releases/Zope/lib/python/Products/PageTemplates In directory cvs.zope.org:/tmp/cvs-serv16592 Modified Files: Tag: evan-pathprefix-branch Expressions.py Added Files: Tag: evan-pathprefix-branch PathPrefixes.py Log Message: Initial implementation of TALES Path prefixes. === Added File Releases/Zope/lib/python/Products/PageTemplates/PathPrefixes.py === from TALES import _valid_name, CompilerError _subpath_prefixes = {} def initialize(): global guarded_getattr from Expressions import guarded_getattr def registerSubPathPrefix(prefix, compiler=None, handler=None, do_validate=0): '''Register a prefix for subpath expressions. A prefixed subpath is a subpath of the form "{px}:{arg}", where {px} is the name of a prefix, and {arg} is an arbitrary (and possibly empty) argument for the prefix. When a subpath is prefixed, during compilation the compiler (if any) for the prefix is called with {px} and {arg} as arguments, and the returned value replaces {arg} in further processing. If no handler is provided, {arg} replaces the subpath. If a handler is provided, it is called during traversal with {prefix}, {arg}, the current traversal object, the list of remaining path elements, and the expression context. The value returned by the handler replaces the current traversal object. If do_validate is true, the security validator is checked. ''' if not _valid_name(prefix): raise ValueError, ( 'Invalid subpath prefix "%s"' % prefix) if compiler is None and handler is None: raise ValueError, ("registerSubPathPrefix requires either " "a compiler or a handler, or both.") _subpath_prefixes[str(prefix)] = (compiler, handler, do_validate) # 'var:x' is replaced with the value of variable 'x' def var_compiler(prefix, arg): arg = arg.strip() if not _valid_name(arg): raise CompilerError, ('"%s" is not a valid variable name' % arg) return arg def var_handler(prefix, arg, object, path, econtext): path.append(econtext.vars[arg]) return object registerSubPathPrefix('var', var_compiler, var_handler) # 'call:' calls the current object. # 'call:x, y, x' passes variables 'x', 'y', and 'z' as arguments. def call_compiler(prefix, arg): args = [name.strip() for name in arg.split(',')] for name in args: if not _valid_name(name): raise CompilerError, ('"%s" is not a valid variable name' % name) return args def call_handler(prefix, arg, object, path, econtext): args = [econtext.vars[name] for name in arg] return object(*args) registerSubPathPrefix('call', call_compiler, call_handler) # 'key:foo' tries to fetch key 'foo' of the current object. def key_handler(prefix, arg, object, path, econtext): return object[arg] registerSubPathPrefix('key', handler=key_handler, do_validate=1) # 'item:6' tries to fetch integer key '6' of the current object. def item_compiler(prefix, arg): return int(arg) registerSubPathPrefix('item', compiler=item_compiler, handler=key_handler, do_validate=1) # 'attr:foo' tries to fetch attribute 'foo' of the current object. def attr_compiler(prefix, arg): arg = arg.strip() if not _valid_name(arg): raise CompilerError, ('"%s" is not a valid attribute name' % arg) return arg def attr_handler(prefix, arg, object, path, econtext): return guarded_getattr(object, arg) registerSubPathPrefix('attr', attr_compiler, attr_handler) # 'fmt:dollars_and_cents' calls standard PythonScript library # function 'dollars_and_cents' on the current object. # 'fmt:%.2f' uses the Python formatting operator to format the # current object as a floating point number with two decimal places. try: from Products.PythonScripts import standard _fmt_names = ('whole_dollars', 'dollars_and_cents', 'structured_text', 'restructured_text', 'sql_quote', 'html_quote', 'url_quote', 'url_quote_plus', 'newline_to_br', 'thousands_commas', 'url_unquote', 'url_unquote_plus', 'urlencode') except: _fmt_names = () def fmt_handler(prefix, arg, object, path, econtext): if arg in _fmt_names: return getattr(standard, arg)(object) return arg % object registerSubPathPrefix('fmt', handler=fmt_handler) === Releases/Zope/lib/python/Products/PageTemplates/Expressions.py 1.43 => 1.43.46.1 === --- Releases/Zope/lib/python/Products/PageTemplates/Expressions.py:1.43 Thu Sep 26 17:33:17 2002 +++ Releases/Zope/lib/python/Products/PageTemplates/Expressions.py Tue Jul 29 15:55:43 2003 @@ -23,7 +23,7 @@ from TALES import Engine, CompilerError, _valid_name, NAME_RE, \ Undefined, Default, _parse_expr from Acquisition import aq_base, aq_inner, aq_parent - +import PathPrefixes _engine = None def getEngine(): @@ -32,6 +32,7 @@ from PathIterator import Iterator _engine = Engine(Iterator) installHandlers(_engine) + PathPrefixes.initialize() return _engine def installHandlers(engine): @@ -111,6 +112,19 @@ raise return ob +class SubPathHandler: + def __init__(self, prefix, arg, handler, do_validate): + self.prefix = prefix + self.arg = arg + self.handler = handler + self.do_validate = do_validate + def __call__(self, object, path, econtext, validate): + arg = self.arg + o = self.handler(self.prefix, arg, object, path, econtext) + if self.do_validate and not validate(object, object, arg, o): + raise Unauthorized, arg + return o + class SubPathExpr: def __init__(self, path): self._path = path = path.strip().split('/') @@ -119,10 +133,23 @@ raise CompilerError, 'Invalid variable name "%s"' % base # Parse path self._dp = dp = [] + prefixes = PathPrefixes._subpath_prefixes for i in range(len(path)): e = path[i] if e[:1] == '?' and _valid_name(e[1:]): dp.append((i, e[1:])) + elif ':' in e: + prefix, arg = e.split(':', 1) + if not prefixes.has_key(prefix): + raise CompilerError, ( + 'Unknown prefix "%s"' % prefix) + compiler, handler, do_v = prefixes.get(prefix) + if compiler is not None: + arg = compiler(prefix, arg) + if handler is None: + path[i] = arg + else: + path[i] = SubPathHandler(prefix, arg, handler, do_v) dp.reverse() def _eval(self, econtext, @@ -147,7 +174,7 @@ if isinstance(ob, DeferWrapper): ob = ob() if path: - ob = restrictedTraverse(ob, path, getSecurityManager()) + ob = restrictedTraverse(ob, path, getSecurityManager(), econtext) return ob class PathExpr: @@ -292,7 +319,7 @@ return 'defer:%s' % `self._s` -def restrictedTraverse(object, path, securityManager, +def restrictedTraverse(object, path, securityManager, econtext, get=getattr, has=hasattr, N=None, M=[], TupleType=type(()) ): @@ -307,6 +334,12 @@ if isinstance(name, TupleType): object = object(*name) continue + + if isinstance(name, SubPathHandler): + object = name(object, path, econtext, validate) + continue + + name = str(name) if not name or name[0] == '_': # Skip directly to item access From philikon at philikon.de Wed Jul 30 18:16:56 2003 From: philikon at philikon.de (Philipp von Weitershausen) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL/tests - test_talinterpreter.py:1.7 Message-ID: <200307302216.h6UMGu013209@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL/tests In directory cvs.zope.org:/tmp/cvs-serv13013/TAL/tests Modified Files: test_talinterpreter.py Log Message: Put an encoding on top of files that use non-ASCII characters to make DeprecationWarnings in Python 2.3 go away. See http://www.python.org/peps/pep-0263.html for more information. === Zope/lib/python/TAL/tests/test_talinterpreter.py 1.6 => 1.7 === --- Zope/lib/python/TAL/tests/test_talinterpreter.py:1.6 Thu Jan 30 13:18:46 2003 +++ Zope/lib/python/TAL/tests/test_talinterpreter.py Wed Jul 30 18:16:49 2003 @@ -1,4 +1,16 @@ -#! /usr/bin/env python1.5 +# -*- coding: ISO-8859-1 -*- +############################################################################## +# +# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE +# +############################################################################## """Tests for TALInterpreter.""" import sys From philikon at philikon.de Wed Jul 30 18:19:34 2003 From: philikon at philikon.de (Philipp von Weitershausen) Date: Sun Aug 10 17:05:18 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/TAL/tests - test_talinterpreter.py:1.6.12.1 Message-ID: <200307302219.h6UMJYv13676@cvs.baymountain.com> Update of /cvs-repository/Zope/lib/python/TAL/tests In directory cvs.zope.org:/tmp/cvs-serv13528/TAL/tests Modified Files: Tag: Zope-2_7-branch test_talinterpreter.py Log Message: Merged changes from HEAD: Put an encoding on top of files that use non-ASCII characters to make DeprecationWarnings in Python 2.3 go away. See http://www.python.org/peps/pep-0263.html for more information. === Zope/lib/python/TAL/tests/test_talinterpreter.py 1.6 => 1.6.12.1 === --- Zope/lib/python/TAL/tests/test_talinterpreter.py:1.6 Thu Jan 30 13:18:46 2003 +++ Zope/lib/python/TAL/tests/test_talinterpreter.py Wed Jul 30 18:19:29 2003 @@ -1,4 +1,16 @@ -#! /usr/bin/env python1.5 +# -*- coding: ISO-8859-1 -*- +############################################################################## +# +# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE +# +############################################################################## """Tests for TALInterpreter.""" import sys