Ticket #9237 (new enhancement)

Opened 2 years ago

Last modified 1 year ago

if category is not set, use default category defined in trac.ini

Reported by: falkb Assigned to: osimons
Priority: normal Component: FullBlogPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

Usually, users forget to set a category when they post a new blog entry. This is bad since then it's not available or caught via the category survey.

This plugin could handle that by automatically setting a default category if none is set on posting. And I want to specify the default category in trac.ini.

Attachments

Change History

10/05/11 11:41:25 changed by osimons

Good idea. Could also be extended to include editing of this setting in Admin too.

12/01/11 08:29:17 changed by falkb

This should work:

Index: fullblogplugin/0.11/tracfullblog/model.py
===================================================================
--- fullblogplugin/0.11/tracfullblog/model.py	(revision 10751)
+++ fullblogplugin/0.11/tracfullblog/model.py	(working copy)
@@ -501,6 +501,9 @@
             fields['author'] = row[6]
             fields['categories'] = row[7]
             fields['category_list'] = set(_parse_categories(row[7]))
+        if (fields['categories'] == ''):
+            fields['categories'] = self.env.config.get('fullblog', 'default_categories')
+            fields['category_list'] = set(_parse_categories(fields['categories']))
         return fields
 
     def _load_post(self, version=0):

Add/Change #9237 (if category is not set, use default category defined in trac.ini)




Change Properties
Action