Merge lp:~brunobord/scribes/scribes-rfc2822 into lp:scribes

Proposed by Bruno Bord
Status: Merged
Approved by: Mystilleef
Approved revision: 433
Merged at revision: not available
Proposed branch: lp:~brunobord/scribes/scribes-rfc2822
Merge into: lp:scribes
Diff against target: None lines
To merge this branch: bzr merge lp:~brunobord/scribes/scribes-rfc2822
Reviewer Review Type Date Requested Status
Mystilleef Approve
Review via email: mp+5560@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Bruno Bord (brunobord) wrote :

Just added a tiny template placeholder I needed (to edit Changelogs more easily) : ${rfc2822}.
It writes the date as the RFC2822 wants it, for example:

Wed, 15 Apr 2009 12:12:36 +0200

(it's the same as the shell command "date -R")

Revision history for this message
Mystilleef (mystilleef) wrote :

Will work on merging it as soon as possible.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Templates/utils.py'
2--- plugins/Templates/utils.py 2009-02-26 05:35:12 +0000
3+++ plugins/Templates/utils.py 2009-04-15 10:08:32 +0000
4@@ -2,7 +2,8 @@
5 from re import UNICODE, compile as compile_
6 placeholder_pattern = compile_("\$\{[^${}]*\}", UNICODE)
7 special_placeholders = ("${time}", "${timestring}", "${timestamp}",
8- "${date}", "${day}", "${month}", "${year}", "${author}")
9+ "${date}", "${day}", "${month}", "${year}",
10+ "${author}", "${rfc2822}")
11
12
13 def replace_special_placeholder(placeholder):
14@@ -33,6 +34,9 @@
15 from time import localtime
16 thetime = localtime()
17 return "[%s-%s-%s] %s:%s:%s" % (thetime[0], pad_zero(thetime[1]), pad_zero(thetime[2]), pad_zero(thetime[3]), pad_zero(thetime[4]), pad_zero(thetime[5]))
18+ if placeholder == "${rfc2822}":
19+ from email.utils import formatdate
20+ return formatdate(localtime=1)
21 if placeholder == "${author}":
22 return get_author_name()
23