Opened 10 years ago

Closed 9 years ago

Last modified 7 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


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

  • tracfullblog/

    1010(c) 2007 ::: - BV Network AS (
     13from time import gmtime, strftime
    1314from genshi.builder import tag
    1516from trac.attachment import ILegacyAttachmentPolicyDelegate
    3940        """Option to specify how many recent posts to display on the
    4041        front page of the Blog.""")
    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']
    182183        # Do some more fundamental checking
    183184        if in self.reserved_names:
    184185            warnings.append((req, "'%s' is a reserved name. Please change." %
    185         if == 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 10 years ago by anonymous

I must agree with this enhancement.

comment:2 Changed 10 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 10 years ago by osimons

Resolution: fixed
Status: newclosed

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.


comment:4 Changed 9 years ago by pete

Resolution: fixed
Status: closedreopened

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 9 years ago by pete

Resolution: worksforme
Status: reopenedclosed

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

comment:6 Changed 9 years ago by osimons

Resolution: worksforme
Status: closedreopened

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

comment:7 Changed 9 years ago by osimons

Resolution: fixed
Status: reopenedclosed

...and back to original resolution.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain osimons.
The resolution will be deleted.

Add Comment

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

Note: See TracTickets for help on using tickets.