From b892f758a8745667d784b75966f6c4ebfae3ab83 Mon Sep 17 00:00:00 2001 From: Skami18 Date: Tue, 26 Jul 2011 17:45:15 +0200 Subject: [PATCH] Pelican show a warning instead of raising an exception if the author of an article is not found an there is no settings file --- pelican/contents.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pelican/contents.py b/pelican/contents.py index 30477493..b7bc2502 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -2,6 +2,7 @@ from pelican.utils import slugify, truncate_html_words from pelican.log import * from pelican.settings import _DEFAULT_CONFIG +from os import getenv class Page(object): """Represents a page @@ -34,6 +35,9 @@ class Page(object): if not hasattr(self, 'author'): if 'AUTHOR' in settings: self.author = settings['AUTHOR'] + else: + self.author = getenv('USER', 'John Doe') + warning("Author of `{0}' unknow, assuming that his name is `{1}'".format(filename or self.title, self.author).decode("utf-8")) # manage languages self.in_default_lang = True