"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Cheetah/Tests/Regressions.py" between
cheetah3-3.2.1.tar.gz and cheetah3-3.2.2.tar.gz

About: Cheetah3 is a template engine and code generation tool for e.g. for Web development or Java, SQL, LaTeX, form email ... (written in Python).

Regressions.py  (cheetah3-3.2.1):Regressions.py  (cheetah3-3.2.2)
#!/usr/bin/env python #!/usr/bin/env python
try:
from cgi import escape as html_escape
except ImportError: # Python 3.8+
from html import escape as html_escape
import unittest import unittest
import Cheetah.NameMapper import Cheetah.NameMapper
import Cheetah.Template import Cheetah.Template
from Cheetah.compat import unicode # noqa from Cheetah.compat import unicode # noqa
class GetAttrException(Exception): class GetAttrException(Exception):
pass pass
class CustomGetAttrClass(object): class CustomGetAttrClass(object):
def __getattr__(self, name): def __getattr__(self, name):
skipping to change at line 136 skipping to change at line 141
Output: Output:
Traceback (most recent call last): Traceback (most recent call last):
File "test.py", line 12, in <module> File "test.py", line 12, in <module>
t.respond() t.respond()
File "DynamicallyCompiledCheetahTemplate.py", line 86, in respond File "DynamicallyCompiledCheetahTemplate.py", line 86, in respond
File "/usr/lib64/python2.6/cgi.py", line 1035, in escape File "/usr/lib64/python2.6/cgi.py", line 1035, in escape
s = s.replace("&", "&") # Must be done first! s = s.replace("&", "&") # Must be done first!
''' '''
def test_FailingBehavior(self): def test_FailingBehavior(self):
import cgi
template = Cheetah.Template.Template( template = Cheetah.Template.Template(
"$escape($request)", "$escape($request)",
searchList=[{'escape': cgi.escape, 'request': 'foobar'}]) searchList=[{'escape': html_escape, 'request': 'foobar'}])
assert template assert template
self.assertRaises(AttributeError, template.respond) self.assertRaises(AttributeError, template.respond)
def test_FailingBehaviorWithSetting(self): def test_FailingBehaviorWithSetting(self):
import cgi
template = Cheetah.Template.Template( template = Cheetah.Template.Template(
"$escape($request)", "$escape($request)",
searchList=[{'escape': cgi.escape, 'request': 'foobar'}], searchList=[{'escape': html_escape, 'request': 'foobar'}],
compilerSettings={'prioritizeSearchListOverSelf': True}) compilerSettings={'prioritizeSearchListOverSelf': True})
assert template assert template
assert template.respond() assert template.respond()
class Mantis_Issue_21_Regression_Test(unittest.TestCase): class Mantis_Issue_21_Regression_Test(unittest.TestCase):
''' '''
Test case for bug outlined in issue #21 Test case for bug outlined in issue #21
Effectively @staticmethod and @classmethod Effectively @staticmethod and @classmethod
decorated methods in templates don't decorated methods in templates don't
 End of changes. 5 change blocks. 
4 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)