mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
*_SAVE_AS = None fix
Ability to disable creating some files when their `_SAVE_AS` setting is set to none-value. Mostly for disabling creating of `authors` stuff (when there only one user, see #320 for details)
This commit is contained in:
parent
800a5a6d4a
commit
6116236ed9
2 changed files with 4 additions and 1 deletions
|
|
@ -183,7 +183,8 @@ class URLWrapper(object):
|
||||||
|
|
||||||
def _from_settings(self, key):
|
def _from_settings(self, key):
|
||||||
setting = "%s_%s" % (self.__class__.__name__.upper(), key)
|
setting = "%s_%s" % (self.__class__.__name__.upper(), key)
|
||||||
return unicode(self.settings[setting]).format(**self.as_dict())
|
value = self.settings[setting] or ''
|
||||||
|
return unicode(value).format(**self.as_dict())
|
||||||
|
|
||||||
url = property(functools.partial(_from_settings, key='URL'))
|
url = property(functools.partial(_from_settings, key='URL'))
|
||||||
save_as = property(functools.partial(_from_settings, key='SAVE_AS'))
|
save_as = property(functools.partial(_from_settings, key='SAVE_AS'))
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,8 @@ class Writer(object):
|
||||||
:param **kwargs: additional variables to pass to the templates
|
:param **kwargs: additional variables to pass to the templates
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if not name: return
|
||||||
|
|
||||||
def _write_file(template, localcontext, output_path, name):
|
def _write_file(template, localcontext, output_path, name):
|
||||||
"""Render the template write the file."""
|
"""Render the template write the file."""
|
||||||
old_locale = locale.setlocale(locale.LC_ALL)
|
old_locale = locale.setlocale(locale.LC_ALL)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue