mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
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
This commit is contained in:
parent
ed954ee839
commit
0b6896a0ab
1 changed files with 4 additions and 3 deletions
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue