Archive page not showing dates properly

On the archive page of my mailman list the dates are not showing up properly. It looks like this: http://i.imgur.com/IrmWnie.png
As you can see, instead of the date a string "%(date)s" is shown. It is also worth noting, that it already worked properly. However, suddenly (at least I cannot state when exactly) it stopped working and since then dates are shown as seen in the screenshot.
The archives are generated with Pipermail 0.09 (Mailman edition).
How can I fix this problem?
Thanks and best, Peter

On 08/21/2015 02:29 AM, Peter Wetz wrote:
On the archive page of my mailman list the dates are not showing up properly. It looks like this: http://i.imgur.com/IrmWnie.png
As you can see, instead of the date a string "%(date)s" is shown. It is also worth noting, that it already worked properly. However, suddenly (at least I cannot state when exactly) it stopped working and since then dates are shown as seen in the screenshot.
The standard Mailman archidxentry.html template does not have a %(date)s substitution in it. Presumably, your installation/list has a custom version of this template (<http://wiki.list.org/x/4030605>) which adds the %(date)s substitution and along with this, modifications to Mailman/Archiver/HyperArch.py to add a 'date' entry to the interpolation dictionary for this template, and also presumably, some Mailman upgrade removed the modification to HyperArch.py.
How can I fix this problem?
Replace the current Mailman/Archiver/HyperArch.py with the one that was there when it worked, or in the definition of write_index_entry at about line 1073 where you see
d = {
'filename': urllib.quote(article.filename),
'subject': subject,
'sequence': article.sequence,
'author': author
}
change it to
d = {
'filename': urllib.quote(article.filename),
'subject': subject,
'sequence': article.sequence,
'date': article.datestr,
'author': author
}
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

thanks for the help. what do I have to do after editing Mailman/Archiver/HyperArch.py as suggested by you? Or: How can I test, if the changes actually changed something?
Because right now, I added your changes and sent a testmail to the list. The mail gets added to the archive, however, the date still looks as in the screenshot posted in my initial posting.
On Fri, Aug 21, 2015 at 4:59 PM, Mark Sapiro <mark@msapiro.net> wrote:
On 08/21/2015 02:29 AM, Peter Wetz wrote:
On the archive page of my mailman list the dates are not showing up properly. It looks like this: http://i.imgur.com/IrmWnie.png
As you can see, instead of the date a string "%(date)s" is shown. It is also worth noting, that it already worked properly. However, suddenly (at least I cannot state when exactly) it stopped working and since then dates are shown as seen in the screenshot.
The standard Mailman archidxentry.html template does not have a %(date)s substitution in it. Presumably, your installation/list has a custom version of this template (<http://wiki.list.org/x/4030605>) which adds the %(date)s substitution and along with this, modifications to Mailman/Archiver/HyperArch.py to add a 'date' entry to the interpolation dictionary for this template, and also presumably, some Mailman upgrade removed the modification to HyperArch.py.
How can I fix this problem?
Replace the current Mailman/Archiver/HyperArch.py with the one that was there when it worked, or in the definition of write_index_entry at about line 1073 where you see
d = { 'filename': urllib.quote(article.filename), 'subject': subject, 'sequence': article.sequence, 'author': author }
change it to
d = { 'filename': urllib.quote(article.filename), 'subject': subject, 'sequence': article.sequence, 'date': article.datestr, 'author': author }
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mailman-Users mailing list Mailman-Users@python.org https://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://wiki.list.org/x/AgA3 Security Policy: http://wiki.list.org/x/QIA9 Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/ Unsubscribe: https://mail.python.org/mailman/options/mailman-users/wetz.peter%40gmail.com

okay, my admin forgot to restart the service. the dates are now working again!
one more question: how/where can I format the string? right now it looks like this: "Mon, 24 Aug 2015 14:18:21 +0200" I would like the following: "24 Aug 2015 14:18:21"
Thanks and best, Peter
On Fri, Aug 21, 2015 at 4:59 PM, Mark Sapiro <mark@msapiro.net> wrote:
On 08/21/2015 02:29 AM, Peter Wetz wrote:
On the archive page of my mailman list the dates are not showing up properly. It looks like this: http://i.imgur.com/IrmWnie.png
As you can see, instead of the date a string "%(date)s" is shown. It is also worth noting, that it already worked properly. However, suddenly (at least I cannot state when exactly) it stopped working and since then dates are shown as seen in the screenshot.
The standard Mailman archidxentry.html template does not have a %(date)s substitution in it. Presumably, your installation/list has a custom version of this template (<http://wiki.list.org/x/4030605>) which adds the %(date)s substitution and along with this, modifications to Mailman/Archiver/HyperArch.py to add a 'date' entry to the interpolation dictionary for this template, and also presumably, some Mailman upgrade removed the modification to HyperArch.py.
How can I fix this problem?
Replace the current Mailman/Archiver/HyperArch.py with the one that was there when it worked, or in the definition of write_index_entry at about line 1073 where you see
d = { 'filename': urllib.quote(article.filename), 'subject': subject, 'sequence': article.sequence, 'author': author }
change it to
d = { 'filename': urllib.quote(article.filename), 'subject': subject, 'sequence': article.sequence, 'date': article.datestr, 'author': author }
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mailman-Users mailing list Mailman-Users@python.org https://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://wiki.list.org/x/AgA3 Security Policy: http://wiki.list.org/x/QIA9 Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/ Unsubscribe: https://mail.python.org/mailman/options/mailman-users/wetz.peter%40gmail.com

okay, sorry for the spam, but I already wrapped my head around how to change the date format.
just use python's functionality to parse it into a different string. for instance: 'date': datetime.datetime.strptime(article.datestr, "%a, %d %b %Y %H:%M:%S %z").strftime("%d %b %Y %H:%M:%S"),
best, Peter
On Fri, Aug 21, 2015 at 4:59 PM, Mark Sapiro <mark@msapiro.net> wrote:
On 08/21/2015 02:29 AM, Peter Wetz wrote:
On the archive page of my mailman list the dates are not showing up properly. It looks like this: http://i.imgur.com/IrmWnie.png
As you can see, instead of the date a string "%(date)s" is shown. It is also worth noting, that it already worked properly. However, suddenly (at least I cannot state when exactly) it stopped working and since then dates are shown as seen in the screenshot.
The standard Mailman archidxentry.html template does not have a %(date)s substitution in it. Presumably, your installation/list has a custom version of this template (<http://wiki.list.org/x/4030605>) which adds the %(date)s substitution and along with this, modifications to Mailman/Archiver/HyperArch.py to add a 'date' entry to the interpolation dictionary for this template, and also presumably, some Mailman upgrade removed the modification to HyperArch.py.
How can I fix this problem?
Replace the current Mailman/Archiver/HyperArch.py with the one that was there when it worked, or in the definition of write_index_entry at about line 1073 where you see
d = { 'filename': urllib.quote(article.filename), 'subject': subject, 'sequence': article.sequence, 'author': author }
change it to
d = { 'filename': urllib.quote(article.filename), 'subject': subject, 'sequence': article.sequence, 'date': article.datestr, 'author': author }
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mailman-Users mailing list Mailman-Users@python.org https://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://wiki.list.org/x/AgA3 Security Policy: http://wiki.list.org/x/QIA9 Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/ Unsubscribe: https://mail.python.org/mailman/options/mailman-users/wetz.peter%40gmail.com

On 08/24/2015 07:34 AM, Peter Wetz wrote:
okay, sorry for the spam, but I already wrapped my head around how to change the date format.
just use python's functionality to parse it into a different string. for instance: 'date': datetime.datetime.strptime(article.datestr, "%a, %d %b %Y %H:%M:%S %z").strftime("%d %b %Y %H:%M:%S"),
Or, perhaps a bit simpler:
'date': datetime.datetime.fromtimestamp(article.date).strftime("%d %b %Y %H:%M:%S")
or simpler still and not requiring import of datetime (HyperArch.py already imports time
'date': time.strftime("%d %b %Y %H:%M:%S", time.localtime(article.date))
Note that the article instance has attributes
# datestr : The posting date, in human-readable format # date : The posting date, in purely numeric format
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

okay, sorry for the spam, but I already wrapped my head around how to change the date format.
just use python's functionality to parse it into a different string. for instance: 'date': datetime.datetime.strptime(article.datestr, "%a, %d %b %Y %H:%M:%S %z").strftime("%d %b %Y %H:%M:%S"),
Or, perhaps a bit simpler:
'date': datetime.datetime.fromtimestamp(article.date).strftime("%d %b %Y %H:%M:%S")
or simpler still and not requiring import of datetime (HyperArch.py already imports time
'date': time.strftime("%d %b %Y %H:%M:%S", time.localtime(article.date))
hm, I get this error though:
Aug 25 07:53:42 2015 (2883) Uncaught runner exception: a float is required Aug 25 07:53:42 2015 (2883) Traceback (most recent call last): File "/var/lib/mailman/Mailman/Queue/Runner.py", line 120, in _oneloop self._onefile(msg, msgdata) File "/var/lib/mailman/Mailman/Queue/Runner.py", line 191, in _onefile keepqueued = self._dispose(mlist, msg, msgdata) File "/var/lib/mailman/Mailman/Queue/ArchRunner.py", line 73, in _dispose mlist.ArchiveMail(msg) File "/var/lib/mailman/Mailman/Archiver/Archiver.py", line 215, in ArchiveMail h.close() File "/var/lib/mailman/Mailman/Archiver/pipermail.py", line 323, in close self.update_dirty_archives() File "/var/lib/mailman/Mailman/Archiver/pipermail.py", line 540, in update_dirty_archives self.update_archive(i) File "/var/lib/mailman/Mailman/Archiver/HyperArch.py", line 1135, in update_archive self.__super_update_archive(archive) File "/var/lib/mailman/Mailman/Archiver/pipermail.py", line 444, in update_archive self._update_simple_index(hdr, archive, arcdir) File "/var/lib/mailman/Mailman/Archiver/pipermail.py", line 465, in _update_simple_index self.write_index_entry(article) File "/var/lib/mailman/Mailman/Archiver/HyperArch.py", line 1072, in write_index_entry 'date': time.strftime("%d %b %Y %H:%M:%S", time.localtime(article.date)), TypeError: a float is required
"a float is required" this implies that "article.date" is not a float in my case. maybe it needs to be converted to a float explicitly? any other suggestions?
Note that the article instance has attributes
# datestr : The posting date, in human-readable format # date : The posting date, in purely numeric format
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

On 08/24/2015 11:35 PM, Peter Wetz wrote:
hm, I get this error though:
...
File "/var/lib/mailman/Mailman/Archiver/HyperArch.py", line 1072, in write_index_entry 'date': time.strftime("%d %b %Y %H:%M:%S", time.localtime(article.date)), TypeError: a float is required
"a float is required" this implies that "article.date" is not a float in my case. maybe it needs to be converted to a float explicitly? any other suggestions?
No. Converting it to float is the appropriate thing. e.g.
'date': time.strftime("%d %b %Y %H:%M:%S", time.localtime(float(article.date))),
The issue is that while article.date is a *nix timestamp, it is a string rather than an int or float.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

thanks. that did the trick. works smoothly now.
On Sun, Aug 30, 2015 at 12:09 AM, Mark Sapiro <mark@msapiro.net> wrote:
On 08/24/2015 11:35 PM, Peter Wetz wrote:
hm, I get this error though:
...
File "/var/lib/mailman/Mailman/Archiver/HyperArch.py", line 1072, in write_index_entry 'date': time.strftime("%d %b %Y %H:%M:%S", time.localtime(article.date)), TypeError: a float is required
"a float is required" this implies that "article.date" is not a float in my case. maybe it needs to be converted to a float explicitly? any other suggestions?
No. Converting it to float is the appropriate thing. e.g.
'date': time.strftime("%d %b %Y %H:%M:%S", time.localtime(float(article.date))),
The issue is that while article.date is a *nix timestamp, it is a string rather than an int or float.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

presumably, some Mailman upgrade removed the modification to HyperArch.py.
Is there some sort of best practice on how to avoid this situation? That is, how to avoid modification of HyperArch.py through some Mailman upgrade?
best, Peter
On Fri, Aug 21, 2015 at 4:59 PM, Mark Sapiro <mark@msapiro.net> wrote:
On 08/21/2015 02:29 AM, Peter Wetz wrote:
On the archive page of my mailman list the dates are not showing up properly. It looks like this: http://i.imgur.com/IrmWnie.png
As you can see, instead of the date a string "%(date)s" is shown. It is also worth noting, that it already worked properly. However, suddenly (at least I cannot state when exactly) it stopped working and since then dates are shown as seen in the screenshot.
The standard Mailman archidxentry.html template does not have a %(date)s substitution in it. Presumably, your installation/list has a custom version of this template (<http://wiki.list.org/x/4030605>) which adds the %(date)s substitution and along with this, modifications to Mailman/Archiver/HyperArch.py to add a 'date' entry to the interpolation dictionary for this template, and also presumably, some Mailman upgrade removed the modification to HyperArch.py.
How can I fix this problem?
Replace the current Mailman/Archiver/HyperArch.py with the one that was there when it worked, or in the definition of write_index_entry at about line 1073 where you see
d = { 'filename': urllib.quote(article.filename), 'subject': subject, 'sequence': article.sequence, 'author': author }
change it to
d = { 'filename': urllib.quote(article.filename), 'subject': subject, 'sequence': article.sequence, 'date': article.datestr, 'author': author }
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mailman-Users mailing list Mailman-Users@python.org https://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://wiki.list.org/x/AgA3 Security Policy: http://wiki.list.org/x/QIA9 Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/ Unsubscribe: https://mail.python.org/mailman/options/mailman-users/wetz.peter%40gmail.com

On 08/24/2015 08:06 AM, Peter Wetz wrote:
presumably, some Mailman upgrade removed the modification to HyperArch.py.
Is there some sort of best practice on how to avoid this situation? That is, how to avoid modification of HyperArch.py through some Mailman upgrade?
A few things survive upgrades. mm_cfg.py is not changed in an upgrade and list specific templates in lists/LISTNAME/LC/, domain specific templates in templates/DOMAIN/ and sitewide templates in templates/site/ are not changed.
Any modified modules in the Mailman/ directory will be replaced in an upgrade. Therefore, best practice is to keep all your local mods in patch files and reapply the patches following an upgrade.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
Mark Sapiro
-
Peter Wetz