[quills-dev] Entry description generated automatically
Andrey Fedoseev andrey.fedoseev at gmail.comSun Dec 17 08:58:36 UTC 2006
- Previous message: [quills-dev] [Quills Issue Tracker] Response to #77 - Atom-feed empty as "Live bookmark" in Firefox
- Next message: [quills-dev] Entry description generated automatically
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi all.
I made a small change to WeblogEntry.py and I'd like to discuss it
there. Changeset is:
--- WeblogEntry.py (revision 34053)
+++ WeblogEntry.py (working copy)
@@ -160,4 +160,17 @@
# first Y words.
return self.Description()
+ security.declareProtected(perms.View, 'Description')
+ def Description(self):
+ if self.description:
+ return self.description
+ transforms = getToolByName(self, "portal_transforms")
+ plain_data = transforms.convertToData("text/plain",
self.getText())
+
+ plain_data_words = plain_data.split()
+ if len(plain_data_words) < 50:
+ return plain_data
+ else:
+ return " ".join(plain_data_words[:50]) + " ..."
+
If weblog entry doesn't have a description then description is generated
from entry's full text (I use first 50 words). It's useful for me as I
want all entries to have description but I'm too lazy to fill it
manually :)
Plese, tell me what do you think of that.
--
Regards!
Andrey Fedoseev <andrey.fedoseev at gmail.com>
- Previous message: [quills-dev] [Quills Issue Tracker] Response to #77 - Atom-feed empty as "Live bookmark" in Firefox
- Next message: [quills-dev] Entry description generated automatically
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the quills-dev mailing list