Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-Chameleon for openSUSE:Factory checked in at 2022-08-02 22:09:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-Chameleon (Old) and /work/SRC/openSUSE:Factory/.python-Chameleon.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Chameleon" Tue Aug 2 22:09:38 2022 rev:13 rq:992332 version:3.10.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-Chameleon/python-Chameleon.changes 2021-05-20 19:25:59.137714797 +0200 +++ /work/SRC/openSUSE:Factory/.python-Chameleon.new.1533/python-Chameleon.changes 2022-08-02 22:10:29.745998008 +0200 @@ -1,0 +2,9 @@ +Tue Aug 2 11:11:29 UTC 2022 - Otto Hollmann <otto.hollm...@suse.com> + +- version update to 3.10.1 + * Fix __str__ method of chameleon.exc.TemplateError (#356) + * Make scope class dict-like (#305) + * Work in FIPS enabled environments (#345) + * Fix tab handling issue (#350) + +------------------------------------------------------------------- Old: ---- Chameleon-3.9.1.tar.gz New: ---- Chameleon-3.10.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-Chameleon.spec ++++++ --- /var/tmp/diff_new_pack.OLcb8n/_old 2022-08-02 22:10:30.137999138 +0200 +++ /var/tmp/diff_new_pack.OLcb8n/_new 2022-08-02 22:10:30.141999150 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-Chameleon # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-Chameleon -Version: 3.9.1 +Version: 3.10.1 Release: 0 Summary: Fast HTML/XML Template Compiler License: BSD-3-Clause AND BSD-4-Clause AND Python-2.0 AND ZPL-2.1 ++++++ Chameleon-3.9.1.tar.gz -> Chameleon-3.10.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chameleon-3.9.1/CHANGES.rst new/chameleon-3.10.1/CHANGES.rst --- old/chameleon-3.9.1/CHANGES.rst 2021-05-14 08:57:55.000000000 +0200 +++ new/chameleon-3.10.1/CHANGES.rst 2022-05-17 14:04:22.000000000 +0200 @@ -1,6 +1,24 @@ Changes ======= +3.10.1 (2022-05-17) +------------------- + +- Fix __str__ method of chameleon.exc.TemplateError + (`#356 <https://github.com/malthe/chameleon/issues/356>`_) + +3.10.0 (2022-04-06) +------------------- + +- Make scope class dict-like + (`#305 <https://github.com/malthe/chameleon/issues/305>`_) + +- Work in FIPS enabled environments + (`#345 <https://github.com/malthe/chameleon/issues/345>`_) + +- Fix tab handling issue + (`#350 <https://github.com/malthe/chameleon/issues/350>`_) + 3.9.1 (2021-05-14) ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chameleon-3.9.1/docs/reference.rst new/chameleon-3.10.1/docs/reference.rst --- old/chameleon-3.9.1/docs/reference.rst 2021-05-14 08:57:55.000000000 +0200 +++ new/chameleon-3.10.1/docs/reference.rst 2022-05-17 14:04:22.000000000 +0200 @@ -212,6 +212,14 @@ <input type="checkbox" tal:attributes="checked True" /> +This requires ``boolean_attributes`` to be activated, see :py:class:`PageTemplate configuration options<chameleon.PageTemplate>`:: + + template = PageTemplate("<input type="checkbox" tal:attributes="checked True" />", + boolean_attributes={"selected", "checked"}) + // or + + templates = PageTemplateLoader(path, boolean_attributes={"selected", "checked"}) + ``tal:condition`` ^^^^^^^^^^^^^^^^^ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chameleon-3.9.1/setup.py new/chameleon-3.10.1/setup.py --- old/chameleon-3.9.1/setup.py 2021-05-14 08:57:55.000000000 +0200 +++ new/chameleon-3.10.1/setup.py 2022-05-17 14:04:22.000000000 +0200 @@ -1,4 +1,4 @@ -__version__ = '3.9.1' +__version__ = '3.10.1' import os diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chameleon-3.9.1/src/chameleon/compiler.py new/chameleon-3.10.1/src/chameleon/compiler.py --- old/chameleon-3.9.1/src/chameleon/compiler.py 2021-05-14 08:57:55.000000000 +0200 +++ new/chameleon-3.10.1/src/chameleon/compiler.py 2022-05-17 14:04:22.000000000 +0200 @@ -105,7 +105,7 @@ def load_econtext(name): - return template("getitem(KEY)", KEY=ast.Str(s=name), mode="eval") + return template("getname(KEY)", KEY=ast.Str(s=name), mode="eval") def store_econtext(name): @@ -620,9 +620,15 @@ >>> parser = tales.ExpressionParser({'python': tales.PythonExpr}, 'python') >>> engine = functools.partial(ExpressionEngine, parser) - >>> evaluate = ExpressionEvaluator(engine, { + >>> evaluator = ExpressionEvaluator(engine, { ... 'foo': 'bar', - ... }) + ... }) + + We'll use the following convenience function to test the expression + evaluator. + >>> from chameleon.utils import Scope + >>> def evaluate(d, *args): + ... return evaluator(Scope(d), *args) The evaluation function is passed the local and remote context, the expression type and finally the expression. @@ -694,7 +700,7 @@ Any odd name: >>> test(load('frobnitz')) - "getitem('frobnitz')" + "getname('frobnitz')" A 'builtin' name will first be looked up via ``get`` allowing fall back to the global builtin value: @@ -926,12 +932,6 @@ template program. """ - exceptions = NameError, \ - ValueError, \ - AttributeError, \ - LookupError, \ - TypeError - defaults = { 'translate': Symbol(simple_translate), 'decode': Builtin("str"), @@ -1110,7 +1110,7 @@ return functions def visit_Context(self, node): - return template("getitem = econtext.__getitem__") + \ + return template("getname = econtext.get_name") + \ template("get = econtext.get") + \ self.visit(node.node) @@ -1645,9 +1645,7 @@ self._current_slot.append(slot.name) - body = template("getitem = econtext.__getitem__") + \ - template("get = econtext.get") + \ - self.visit(slot.node) + body = self.visit_Context(slot) assert self._current_slot.pop() == slot.name @@ -1678,7 +1676,7 @@ append = template("_slots.appendleft(NAME)", NAME=fun) assignment = [TryExcept( - body=template("_slots = getitem(KEY)", KEY=key), + body=template("_slots = getname(KEY)", KEY=key), handlers=[ast.ExceptHandler(body=assignment)], orelse=append, )] @@ -1753,7 +1751,7 @@ outer[:] = list(self._enter_assignment(names)) + outer outer += template( - "__iterator, INDEX = getitem('repeat')(key, __iterator)", + "__iterator, INDEX = getname('repeat')(key, __iterator)", key=key, INDEX=index ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chameleon-3.9.1/src/chameleon/exc.py new/chameleon-3.10.1/src/chameleon/exc.py --- old/chameleon-3.9.1/src/chameleon/exc.py 2021-05-14 08:57:55.000000000 +0200 +++ new/chameleon-3.10.1/src/chameleon/exc.py 2022-05-17 14:04:22.000000000 +0200 @@ -189,7 +189,7 @@ # Prepend newlines. for line in lines: - text += "\n" + line + text += "\n" + safe_native(line) return text diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chameleon-3.9.1/src/chameleon/parser.py new/chameleon-3.10.1/src/chameleon/parser.py --- old/chameleon-3.9.1/src/chameleon/parser.py 2021-05-14 08:57:55.000000000 +0200 +++ new/chameleon-3.10.1/src/chameleon/parser.py 2022-05-17 14:04:22.000000000 +0200 @@ -12,7 +12,7 @@ match_double_hyphen = re.compile(r'--(?!(-)*>)') match_tag_prefix_and_name = re.compile( - r'^(?P<prefix></?)(?P<name>([^:\n\r ]+:)?[^ \n\t\r>/]+)' + r'^(?P<prefix></?)(?P<name>([^:\n\t\r ]+:)?[^ \n\t\r>/]+)' r'(?P<suffix>(?P<space>\s*)/?>)?', re.UNICODE | re.DOTALL) match_single_attribute = re.compile( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chameleon-3.9.1/src/chameleon/tales.py new/chameleon-3.10.1/src/chameleon/tales.py --- old/chameleon-3.9.1/src/chameleon/tales.py 2021-05-14 08:57:55.000000000 +0200 +++ new/chameleon-3.10.1/src/chameleon/tales.py 2022-05-17 14:04:22.000000000 +0200 @@ -115,11 +115,11 @@ 42 """ - exceptions = NameError, \ - ValueError, \ - AttributeError, \ + exceptions = AttributeError, \ + NameError, \ LookupError, \ - TypeError + TypeError, \ + ValueError ignore_prefix = True @@ -517,7 +517,7 @@ """ - exceptions = AttributeError, LookupError, TypeError, NameError, KeyError + exceptions = AttributeError, LookupError, TypeError, NameError def __init__(self, expression): self.expression = expression diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chameleon-3.9.1/src/chameleon/tests/inputs/127-tags-and-attributes-special-chars.pt new/chameleon-3.10.1/src/chameleon/tests/inputs/127-tags-and-attributes-special-chars.pt --- old/chameleon-3.9.1/src/chameleon/tests/inputs/127-tags-and-attributes-special-chars.pt 1970-01-01 01:00:00.000000000 +0100 +++ new/chameleon-3.10.1/src/chameleon/tests/inputs/127-tags-and-attributes-special-chars.pt 2022-05-17 14:04:22.000000000 +0200 @@ -0,0 +1,4 @@ +<tal:block> + <div style="height:97px" class="${'test'}"> + </div> +</tal:block> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chameleon-3.9.1/src/chameleon/tests/outputs/127.pt new/chameleon-3.10.1/src/chameleon/tests/outputs/127.pt --- old/chameleon-3.9.1/src/chameleon/tests/outputs/127.pt 1970-01-01 01:00:00.000000000 +0100 +++ new/chameleon-3.10.1/src/chameleon/tests/outputs/127.pt 2022-05-17 14:04:22.000000000 +0200 @@ -0,0 +1,3 @@ + + <div style="height:97px" class="test"> + </div> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chameleon-3.9.1/src/chameleon/tests/test_exc.py new/chameleon-3.10.1/src/chameleon/tests/test_exc.py --- old/chameleon-3.9.1/src/chameleon/tests/test_exc.py 2021-05-14 08:57:55.000000000 +0200 +++ new/chameleon-3.10.1/src/chameleon/tests/test_exc.py 2022-05-17 14:04:22.000000000 +0200 @@ -1,13 +1,23 @@ from unittest import TestCase +from chameleon import exc, tokenize class TestTemplateError(TestCase): def test_keep_token_location_info(self): # tokens should not lose information when passed to a TemplateError - from chameleon import exc, tokenize, utils token = tokenize.Token('stuff', 5, 'more\nstuff', 'mystuff.txt') error = exc.TemplateError('message', token) s = str(error) self.assertTrue( '- Location: (line 2: col 0)' in s, 'No location data found\n%s' % s) + + def test_umlaut_exc_to_string(self): + # test if an exception is convertable to a string + body = u'<p>uumlaut:\xfc</p>' + string = body[3:-4] + token = tokenize.Token(string, 3, body) + e = exc.LanguageError('Invalid define syntax', token) + # its fine if we get no exception from the following line + str(e) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chameleon-3.9.1/src/chameleon/utils.py new/chameleon-3.10.1/src/chameleon/utils.py --- old/chameleon-3.9.1/src/chameleon/utils.py 2021-05-14 08:57:55.000000000 +0200 +++ new/chameleon-3.10.1/src/chameleon/utils.py 2022-05-17 14:04:22.000000000 +0200 @@ -401,6 +401,15 @@ set_local = dict.__setitem__ def __getitem__(self, key): + value = self.get(key, marker) + if value is marker: + raise KeyError(key) + return value + + def __contains__(self, key): + return self.get(key, marker) is not marker + + def get(self, key, default=None): value = dict.get(self, key, marker) if value is not marker: return value @@ -412,7 +421,16 @@ if value is not marker: return value - raise NameError(key) + return default + + def items(self): + raise NotImplementedError() + + def keys(self): + raise NotImplementedError() + + def values(self): + raise NotImplementedError() @property def vars(self): @@ -428,6 +446,12 @@ root = getattr(self, "_root", self) root[name] = value + def get_name(self, key): + value = self.get(key, marker) + if value is marker: + raise NameError(key) + return value + setLocal = set_local setGlobal = set_global diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chameleon-3.9.1/src/chameleon/zpt/template.py new/chameleon-3.10.1/src/chameleon/zpt/template.py --- old/chameleon-3.9.1/src/chameleon/zpt/template.py 2021-05-14 08:57:55.000000000 +0200 +++ new/chameleon-3.10.1/src/chameleon/zpt/template.py 2022-05-17 14:04:22.000000000 +0200 @@ -1,6 +1,6 @@ from functools import partial from os.path import dirname -from hashlib import md5 +from hashlib import sha256 from ..i18n import simple_translate from ..tales import PythonExpr @@ -309,7 +309,7 @@ hex = super(PageTemplate, self).digest(body, names) if isinstance(hex, unicode_string): hex = hex.encode('utf-8') - digest = md5(hex) + digest = sha256(hex) digest.update(';'.join(names).encode('utf-8')) for attr in ( @@ -322,7 +322,7 @@ (";%s=%s" % (attr, str(v))).encode('ascii') ) - return digest.hexdigest() + return digest.hexdigest()[:32] def _builtins(self): return {