diff options
author | Georg Brandl <georg@python.org> | 2015-03-08 16:28:23 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2015-03-08 16:28:23 +0100 |
commit | 18b6843696a9f9b46f98a77a4e62825c193ae73a (patch) | |
tree | 5c7e2d6fad4777dc7e56126bcb06723742cea631 /sphinx/jinja2glue.py | |
parent | 8bc5823724e58bc75d165adc77fb78525d0256f2 (diff) | |
download | sphinx-git-18b6843696a9f9b46f98a77a4e62825c193ae73a.tar.gz |
pep8 fixes
Diffstat (limited to 'sphinx/jinja2glue.py')
-rw-r--r-- | sphinx/jinja2glue.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sphinx/jinja2glue.py b/sphinx/jinja2glue.py index b3f3228fb..c8a7165fc 100644 --- a/sphinx/jinja2glue.py +++ b/sphinx/jinja2glue.py @@ -14,7 +14,7 @@ from pprint import pformat from six import string_types from jinja2 import FileSystemLoader, BaseLoader, TemplateNotFound, \ - contextfunction + contextfunction from jinja2.utils import open_if_exists from jinja2.sandbox import SandboxedEnvironment @@ -27,12 +27,14 @@ def _tobool(val): return val.lower() in ('true', '1', 'yes', 'on') return bool(val) + def _toint(val): try: return int(val) except ValueError: return 0 + def accesskey(context, key): """Helper to output each access key only once.""" if '_accesskeys' not in context: @@ -42,11 +44,14 @@ def accesskey(context, key): return 'accesskey="%s"' % key return '' + class idgen(object): def __init__(self): self.id = 0 + def current(self): return self.id + def __next__(self): self.id += 1 return self.id @@ -71,6 +76,7 @@ class SphinxFileSystemLoader(FileSystemLoader): f.close() mtime = path.getmtime(filename) + def uptodate(): try: return path.getmtime(filename) == mtime @@ -80,7 +86,6 @@ class SphinxFileSystemLoader(FileSystemLoader): raise TemplateNotFound(template) - class BuiltinTemplateLoader(TemplateBridge, BaseLoader): """ Interfaces the rendering environment of jinja2 for use in Sphinx. |