Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't use staticmethod.

  • Loading branch information...
commit e4daeeee708bd2eb489a101c18c37be8df2db8a3 1 parent 0db885d
@mythmon authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 wok/page.py
View
14 wok/page.py
@@ -24,9 +24,9 @@ class Page(object):
tmpl_env = None
- @staticmethod
- def create_tmpl_env(options):
- Page.tmpl_env = jinja2.Environment(
+ @classmethod
+ def create_tmpl_env(cls, options):
+ cls.tmpl_env = jinja2.Environment(
loader=GlobFileLoader(
options.get('template_dir', 'templates')),
extensions=options.get('jinja2_extensions', []))
@@ -56,7 +56,7 @@ def from_meta(cls, meta, options, engine, renderer=renderers.Plain):
# Make a template environment. Hopefully no one expects this to ever
# change after it is instantiated.
- if Page.tmpl_env is None:
+ if cls.tmpl_env is None:
cls.create_tmpl_env(page.options)
page.build_meta()
@@ -77,7 +77,7 @@ def from_file(cls, path, options, engine, renderer=renderers.Plain):
logging.info('Loading {0}'.format(os.path.basename(path)))
- if Page.tmpl_env is None:
+ if cls.tmpl_env is None:
cls.create_tmpl_env(page.options)
page.path = path
@@ -268,7 +268,7 @@ def build_meta(self):
# template
try:
template_type = str(self.meta.get('type', 'default'))
- self.template = Page.tmpl_env.get_template(template_type + '.*')
+ self.template = self.tmpl_env.get_template(template_type + '.*')
except jinja2.loaders.TemplateNotFound:
logging.error('No template "{0}.*" found in template directory. Aborting.'
.format(template_type))
@@ -421,7 +421,7 @@ def paginate(self):
'cur_page': idx,
}
})
- new_page = Page.from_meta(new_meta, self.options, self.engine,
+ new_page = self.from_meta(new_meta, self.options, self.engine,
renderer=self.renderer)
logging.debug('page {0} is {1}'.format(idx, new_page))
if new_page:
Please sign in to comment.
Something went wrong with that request. Please try again.