Modify

Opened 7 years ago

Closed 5 years ago

Last modified 3 years ago

#2460 closed enhancement (fixed)

New post shortname based on date

Reported by: anonymous Owned by: osimons
Priority: normal Component: FullBlogPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

It's not useful that new post's default shortname fixed with "change_this_post_shortname". I guess default shortname based on date.

  • tracfullblog/core.py

     
    1010(c) 2007 ::: www.CodeResort.com - BV Network AS (simon-code@bvnetwork.no) 
    1111""" 
    1212 
     13from time import gmtime, strftime 
    1314from genshi.builder import tag 
    1415 
    1516from trac.attachment import ILegacyAttachmentPolicyDelegate 
     
    3940        """Option to specify how many recent posts to display on the 
    4041        front page of the Blog.""") 
    4142 
    42     default_pagename = 'change_this_post_shortname' 
     43    default_pagename = strftime("post_%Y%m%d%H%M%S", gmtime()) 
    4344    reserved_names = ['create', 'view', 'edit', 'delete', 
    4445                    'archive', 'category', 'author'] 
    4546 
     
    182183        # Do some more fundamental checking 
    183184        if bp.name in self.reserved_names: 
    184185            warnings.append((req, "'%s' is a reserved name. Please change." % bp.name)) 
    185         if bp.name == self.default_pagename: 
    186             warnings.append(('post_name', "The default page shortname must be changed.")) 
    187186        # Check if any plugins has objections with the contents 
    188187        fields = { 
    189188            'title': bp.title, 

Attachments (0)

Change History (7)

comment:1 Changed 7 years ago by anonymous

I must agree with this enhancement.

comment:2 Changed 6 years ago by anonymous

I think it could possibly be useful to have the user name in there somewhere too - this would be useful if multiple users are going to be posting heavily to the same Trac blog.

comment:3 Changed 6 years ago by osimons

  • Resolution set to fixed
  • Status changed from new to closed

Well, in [3906] I've done what you requested - and then some more :-)

I'm going to close this ticket with that change, and please open a new ticket if you discover issues with the new features.

Enjoy!

comment:4 Changed 5 years ago by petekalo

  • Resolution fixed deleted
  • Status changed from closed to reopened

Is there a way to add the time at the end of shortname field automatically ie " $USER-%Y/%m/%d/TIME ". I wanted to act as a random number sort of.

comment:5 Changed 5 years ago by petekalo

  • Resolution set to worksforme
  • Status changed from reopened to closed

Nevermind, for anyone who is curions, it is %T that's a capital!!!

comment:6 Changed 5 years ago by osimons

  • Resolution worksforme deleted
  • Status changed from closed to reopened

Good thinking. Need to reopen to close the the ticket again as 'fixed'.

comment:7 Changed 5 years ago by osimons

  • Resolution set to fixed
  • Status changed from reopened to closed

...and back to original resolution.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from osimons. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.