[Mailman-Users] Is there any way to get the date???

Todd Freedom_Lover at pobox.com
Mon Sep 29 02:37:35 CEST 2003

Hash: SHA1

Paul H Byerly wrote:
>      I've asked this before, I've seen others ask it, and I've just spent 
> hours searching for an answer and trying all I can think of to make it work.
>      I would be really nice to be able to put the date a post was written 
> after the subject and author in the "Archives by ..." view.  Anyone made 
> this work?  Anyone have a clue how to make it work?

I didn't have a clue a few minutes ago, and I won't say I have much better
of one now, but here's a quick patch I made that seems to do what you want.
You'll have to remove the dash escapes from the patch text put in by gpg
(which will happen automatically if you have a good MUA that checks
signatures for you).  I could have sent this using the better PGP/MIME
format, but too many (broken, IMO) MUA's make it a pain in the ass to read
messages formatted that, despite the fact that it's a published RFC.

Anyway, have someone that knows python and mailman better than I look this
over before you use it for anything important.

There's only two files I needed to modify, Mailman/Archiver/HyperArch.py,
and templates/en/archidxentry.html.  One thing I can see being a problem is
that lines will get real long so the formatting in archidxentry.html might
need to be played with to keep it readable.

- --- Mailman/Archiver/HyperArch.py~	Sun Sep 28 20:21:28 2003
+++ Mailman/Archiver/HyperArch.py	Sun Sep 28 20:22:43 2003
@@ -965,16 +965,19 @@
     def write_index_entry(self, article):
         subject = self.get_header("subject", article)
         author = self.get_header("author", article)
+        datestr = i18n.ctime(int(article.date))
             author = re.sub('@', _(' at '), author)
         subject = CGIescape(subject, self.lang)
         author = CGIescape(author, self.lang)
+        datestr = CGIescape(datestr, self.lang)
         d = {
             'filename': urllib.quote(article.filename),
             'subject':  subject,
             'sequence': article.sequence,
- -            'author':   author
+            'author':   author,
+            'datestr':  datestr
         print quick_maketext(
             'archidxentry.html', d,
- --- templates/en/archidxentry.html~	Mon Sep 22 15:46:26 2003
+++ templates/en/archidxentry.html	Sun Sep 28 20:19:22 2003
@@ -1,4 +1,4 @@
 <LI><A HREF="%(filename)s">%(subject)s
 </A><A NAME="%(sequence)i">&nbsp;</A>
- -<I>%(author)s
+<I>%(author)s (%(datestr)s)


- -- 
Todd              OpenPGP -> KeyID: 0xD654075A | URL: www.pobox.com/~tmz/pgp
...know that worrying is as effective as trying to solve an algebra
equation by chewing bubble gum.
    -- Kurt Vonnegut

Version: GnuPG v1.2.3 (GNU/Linux)
Comment: When crypto is outlawed bayl bhgynjf jvyy unir cevinpl.


More information about the Mailman-Users mailing list