mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Moved functions.py from templates to theme root
As pointed by @tcg, the functions.py file is more suited to be located in the theme root.
This commit is contained in:
parent
d9ff5bac32
commit
5be529f668
2 changed files with 3 additions and 2 deletions
|
|
@ -64,11 +64,12 @@ class Generator(object):
|
|||
extensions=self.settings['JINJA_EXTENSIONS'],
|
||||
)
|
||||
try:
|
||||
theme_functions = imp.load_source('theme_functions', self._templates_path[0]+'/functions.py')
|
||||
theme_functions = imp.load_source('theme_functions',
|
||||
os.path.join(self.theme, '/functions.py'))
|
||||
except IOError:
|
||||
theme_functions = None
|
||||
|
||||
if theme_functions and '__export__' in vars(theme_functions):
|
||||
if theme_functions and hasattr(theme_functions, '__export__'):
|
||||
for func_name in theme_functions.__export__:
|
||||
self.env.globals[func_name] = getattr(theme_functions, func_name)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue