Modify

Opened 13 years ago

Last modified 13 years ago

#9237 new enhancement

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

Reported by: falkb Owned by: 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 (0)

Change History (2)

comment:1 Changed 13 years ago by osimons

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

comment:2 Changed 13 years ago by falkb

This should work:

  • fullblogplugin/0.11/tracfullblog/model.py

     
    501501            fields['author'] = row[6]
    502502            fields['categories'] = row[7]
    503503            fields['category_list'] = set(_parse_categories(row[7]))
     504        if (fields['categories'] == ''):
     505            fields['categories'] = self.env.config.get('fullblog', 'default_categories')
     506            fields['category_list'] = set(_parse_categories(fields['categories']))
    504507        return fields
    505508
    506509    def _load_post(self, version=0):

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain osimons.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.