Style cleanups in environment and a tiny bugfix.
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 · parent e7086db · Browse files · 1 file·+9 added−8 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+9 added−8 removed
- other:+9 added−8 removed
Provenance
- Commit
641c041- Tree
d5782b3- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
e7086db
1 file changed+9 added−8 removed
modified:jinja2/environment.py+9 added-8 removed
88 unmodified lines89 90 def _environment_sanity_check(environment):91 """Perform a sanity check on the environment."""92 assert issubclass(environment.undefined, Undefined), 'undefined must ' \93- 'be a subclass of undefined because filters depend on it.'93+ 'be a subclass of undefined because filters depend on it.'94 assert environment.block_start_string != \95- environment.variable_start_string != \96- environment.comment_start_string, 'block, variable and comment ' \97- 'start strings must be different'95+ environment.variable_start_string != \96+ environment.comment_start_string, 'block, variable and comment ' \97+ 'start strings must be different'98 assert environment.newline_sequence in ('\r', '\r\n', '\n'), \99- 'newline_sequence set to unknown line ending string.'99+ 'newline_sequence set to unknown line ending string.'100 return environment101 102 103 class Environment(object):446 unmodified lines550 filename = encode_filename(filename)551 return self._compile(source, filename)552 except TemplateSyntaxError:553 exc_info = sys.exc_info()554- self.handle_exception(exc_info, source_hint=source)554+ self.handle_exception(exc_info, source_hint=source_hint)555 556 def compile_expression(self, source, undefined_to_none=True):557 """A handy helper method that returns a callable that accepts keyword558 arguments that appear as variables in the expression. If called it74 unmodified lines633 from warnings import warn634 warn(Warning('py_compile has no effect on pypy or Python 3'))635 py_compile = False636 else:637- import imp, marshal637+ import imp638+ import marshal639 py_header = imp.get_magic() + \640 u'\xff\xff\xff\xff'.encode('iso-8859-15')641 642 # Python 3.3 added a source filesize to the header125 unmodified lines768 if cache_key is None:769 cache_key = name770 if self.cache is not None:771 template = self.cache.get(cache_key)771- if template is not None and (not self.auto_reload or \772+ if template is not None and (not self.auto_reload or773 template.is_up_to_date):774 return template775 template = self.loader.load(self, name, globals)776 if self.cache is not None:427 unmodified lines