Merge branch '2.7-maintenance'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Armin Ronacher · committed by Armin Ronacher · parents d65f40f, 8b0c37c · Browse files · 8 files·+31 added−30 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
8 files+31 added−30 removed
- other:+31 added−30 removed
Provenance
- Commit
8db4791- Tree
bb597c2- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent 1
d65f40f- Parent 2
8b0c37c
8 files changed+31 added−30 removed
modified:jinja2/testsuite/filters.py+2 added
206 unmodified lines207 tmpl = env.from_string('''{{ "foo-bar"|title }}''')208 assert tmpl.render() == "Foo-Bar"209 tmpl = env.from_string('''{{ "foo\tbar"|title }}''')210 assert tmpl.render() == "Foo\tBar"211+ tmpl = env.from_string('''{{ "FOO\tBAR"|title }}''')212+ assert tmpl.render() == "Foo\tBar"213 214 class Foo:215 def __str__(self):216 return 'foo-bar'307 unmodified linesmodified:jinja2/testsuite/imports.py-16 removed
119 unmodified lines120 item="{{ item }}"121 )))122 assert env.get_template("main").render() == "123"123 124- def test_included_block_override(self):125- env = Environment(loader=DictLoader(dict(126- main="{% extends 'base' %}{% block b %}1337{% endblock %}",127- base="{% include 'inc' %}",128- inc="{% block b %}42{% endblock %}"129- )))130- assert env.get_template("main").render() == "1337"131-132- def test_included_block_override_with_super(self):133- env = Environment(loader=DictLoader(dict(134- main="{% extends 'base' %}{% block b %}1337|{{ super() }}{% endblock %}",135- base="{% include 'inc' %}",136- inc="{% block b %}42{% endblock %}"137- )))138- assert env.get_template("main").render() == "1337|42"139-124 def test_unoptimized_scopes(self):125 t = test_env.from_string("""126 {% macro outer(o) %}127 {% macro inner() %}14 unmodified linesmodified:jinja2/compiler.py+2 added-9 removed
947 unmodified lines948 self.writeline('else:')949 self.indent()950 951 if node.with_context:952- self.writeline('include_context = template.new_context('953- 'context.parent, True, locals())')954- self.writeline('for name, context_blocks in context.'955- 'blocks.%s():' % dict_item_iter)956- self.indent()957- self.writeline('include_context.blocks.setdefault('958- 'name, [])[0:0] = context_blocks')959- self.outdent()952 self.writeline('for event in template.root_render_func('961- 'include_context):')953+ 'template.new_context(context.parent, True, '954+ 'locals())):')955 else:956 self.writeline('for event in template.module._body_stream:')957 958 self.indent()682 unmodified linesmodified:jinja2/filters.py+1 added-1 removed
184 unmodified lines185 rv = []186 for item in re.compile(r'([-\s]+)(?u)').split(soft_unicode(s)):187 if not item:188 continue189- rv.append(item[0].upper() + item[1:])189+ rv.append(item[0].upper() + item[1:].lower())190 return ''.join(rv)191 192 193 def do_dictsort(value, case_sensitive=False, by='key'):795 unmodified linesmodified:jinja2/nodes.py+3 added
230 unmodified lines231 232 def __ne__(self, other):233 return not self.__eq__(other)234 235+ # Restore Python 2 hashing behavior on Python 3236+ __hash__ = object.__hash__237+238 def __repr__(self):239 return '%s(%s)' % (240 self.__class__.__name__,241 ', '.join('%s=%r' % (arg, getattr(self, arg, None)) for673 unmodified linesmodified:jinja2/runtime.py+11 added-1 removed
495 unmodified lines496 __getitem__ = __lt__ = __le__ = __gt__ = __ge__ = __int__ = \497 __float__ = __complex__ = __pow__ = __rpow__ = \498 _fail_with_undefined_error499 500+ def __eq__(self, other):501+ return type(self) is type(other)502+503+ def __ne__(self, other):504+ return not self.__eq__(other)505+506+ def __hash__(self):507+ return id(type(self))508+509 def __str__(self):510 return u''511 512 def __len__(self):58 unmodified lines571 UndefinedError: 'foo' is undefined572 """573 __slots__ = ()574 __iter__ = __str__ = __len__ = __nonzero__ = __eq__ = \566- __ne__ = __bool__ = Undefined._fail_with_undefined_error575+ __ne__ = __bool__ = __hash__ = \576+ Undefined._fail_with_undefined_error577 578 579 # remove remaining slots attributes, after the metaclass did the magic they580 # are unneeded and irritating as they contain wrong data for the subclasses.1 unmodified linemodified:scripts/make-release.py+4 added-2 removed
15 unmodified lines16 from datetime import datetime, date17 from subprocess import Popen, PIPE18 19 20+_date_strip_re = re.compile(r'(?<=\d)(st|nd|rd|th)')21+22+23 def parse_changelog():24 with open('CHANGES') as f:25 lineiter = iter(f)26 for line in lineiter:28 unmodified lines55 return '.'.join(map(str, parts))56 57 58 def parse_date(string):56- string = string.replace('th ', ' ').replace('nd ', ' ') \57- .replace('rd ', ' ').replace('st ', ' ')59+ string = _date_strip_re.sub('', string)60 return datetime.strptime(string, '%B %d %Y')61 62 63 def set_filename_version(filename, version_number, pattern):90 unmodified linesmodified:CHANGES+8 added-1 removed
1 unmodified line2 ================3 4 Version 2.7.15 -------------6-(bugfix release)6+(bugfix release, released on August 7th 2013)7 8 - Fixed a bug with ``call_filter`` not working properly on environment9 and context filters.10 - Fixed lack of Python 3 support for bytecode caches.11+- Reverted support for defining blocks in included templates as this12+ broke existing templates for users.13+- Fixed some warnings with hashing of undefineds and nodes if Python14+ is run with warnings for Python 3.15+- Added support for properly hashing undefined objects.16+- Fixed a bug with the title filter not working on already uppercase17+ strings.18 19 Version 2.720 -----------21 (codename Translation, released on May 20th 2013)294 unmodified lines