forked from github/pelican
Pelican show a warning instead of raising an exception if the author of an article is not found an there is no settings file
This commit is contained in:
parent
6611107e48
commit
b892f758a8
1 changed files with 4 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue