[Mailman-Users] {Disarmed} Re: Archive page not showing dates properly
Peter Wetz
wetz.peter at gmail.com
Tue Aug 25 08:35:37 CEST 2015
>
> > 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 at msapiro.net> The highway is for gamblers,
> San Francisco Bay Area, California better use your sense - B. Dylan
>
More information about the Mailman-Users
mailing list