From 0b6896a0ab2866ce9a80deb69ee0677f0d178f0a Mon Sep 17 00:00:00 2001 From: Skami18 Date: Tue, 25 Oct 2011 18:31:17 +0200 Subject: [PATCH] Adding a summary no more make Pelican crashes Setting pelican.readers.Article.summary was impossible and raised an exception because pelican.readers.Article.summary was a @property --- pelican/contents.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index eb9378ba..08195c8c 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -88,6 +88,10 @@ class Page(object): if not hasattr(self, 'status'): self.status = settings['DEFAULT_STATUS'] + # set summary + if not hasattr(self, 'summary'): + self.summary = truncate_html_words(self.content, 50) + def check_properties(self): """test that each mandatory property is set.""" for prop in self.mandatory_properties: @@ -102,9 +106,6 @@ class Page(object): content = self._content return content - @property - def summary(self): - return truncate_html_words(self.content, 50) class Article(Page): mandatory_properties = ('title', 'date', 'category')