diff options
author | Alexis Métaireau <alexis@notmyidea.org> | 2013-07-05 01:08:45 +0200 |
---|---|---|
committer | Alexis Métaireau <alexis@notmyidea.org> | 2013-07-05 01:08:45 +0200 |
commit | 0550c6ef29b2129efe1fbd061669f2909f464559 (patch) | |
tree | 352cde8243600fe4fc48c863f4229ae0019cb156 /pelican/contents.py | |
parent | 7ec4d5faa25040f6cabcf2ddbab58b19c4b77a2c (diff) | |
download | pelican-multiple-authors.tar.gz |
add multiple authorsmultiple-authors
Diffstat (limited to 'pelican/contents.py')
-rw-r--r-- | pelican/contents.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/pelican/contents.py b/pelican/contents.py index 1b604f19..b5da4342 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -68,10 +68,16 @@ class Content(object): #default template if it's not defined in page self.template = self._get_template() - # default author to the one in settings if not defined - if not hasattr(self, 'author'): - if 'AUTHOR' in settings: - self.author = Author(settings['AUTHOR'], settings) + # First, read the authors from "authors", if not, fallback to "author" + # and if not use the settings defined one, if any. + if not hasattr(self, 'author') and 'AUTHOR' in settings: + self.author = Author(settings['AUTHOR'], settings) + + if not hasattr(self, 'authors') and hasattr(self, 'author'): + setattr(self, 'authors', [self.author]) + + if hasattr(self, 'authors') and not hasattr(self, 'author'): + setattr(self, 'author', self.authors[0]) # XXX Split all the following code into pieces, there is too much here. |