Merge pull request #326 from neoascetic/_save_as_behavior

*_SAVE_AS = False fix
This commit is contained in:
Alexis Metaireau 2012-04-26 10:39:56 -07:00
commit 58d98e918f
3 changed files with 14 additions and 1 deletions

View file

@ -142,6 +142,8 @@ Setting name (default value) what does it do?
`TAG_SAVE_AS` ('tag/{name}.html') The location to save the tag page.
================================================ =====================================================
Note: when any of `*_SAVE_AS` is set to False, files will not be created.
Timezone
--------

View file

@ -183,7 +183,12 @@ class URLWrapper(object):
def _from_settings(self, key):
setting = "%s_%s" % (self.__class__.__name__.upper(), key)
return unicode(self.settings[setting]).format(**self.as_dict())
value = self.settings[setting]
if not isinstance(value, (str, unicode)):
logger.warning(u'%s is set to %s' % (setting, value))
return value
else:
return unicode(value).format(**self.as_dict())
url = property(functools.partial(_from_settings, key='URL'))
save_as = property(functools.partial(_from_settings, key='SAVE_AS'))

View file

@ -99,6 +99,12 @@ class Writer(object):
:param **kwargs: additional variables to pass to the templates
"""
if name is False:
return
elif not name:
# other stuff, just return for now
return
def _write_file(template, localcontext, output_path, name):
"""Render the template write the file."""
old_locale = locale.setlocale(locale.LC_ALL)