From 5bcc56fed8896a02640faf6f02e6f72bcb115c35 Mon Sep 17 00:00:00 2001 From: Massimo Santini Date: Tue, 4 Oct 2011 07:43:26 +0200 Subject: [PATCH] elativize URLs in summary as we do for content (this time by rewriting summary as a property to defer the access to content when URLs in it have been relativized by the writer). --- pelican/contents.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index d0859a96..eb9378ba 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -84,10 +84,6 @@ class Page(object): else: self.locale_date = self.date.strftime(self.date_format.encode('ascii','xmlcharrefreplace')).decode('utf') - # manage summary - if not hasattr(self, 'summary'): - self.summary = property(lambda self: truncate_html_words(self.content, 50)).__get__(self, Page) - # manage status if not hasattr(self, 'status'): self.status = settings['DEFAULT_STATUS'] @@ -106,6 +102,9 @@ 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')