Re: [Mailman-Users] Reverse chronological date order for archives

2015-11-18 Thread Mark Sapiro
On 11/17/15 7:46 PM, ListGnome ProtonMail via Mailman-Users wrote:
> Hi,
> 
> Has anyone been able to order their archive messages in reverse chronological 
> date order - so the most recent post is at the top of the page. (Version 
> 2.1.20)
> 
> I found a related thread in the Mailman-Users archive (dated 2002) but it 
> didn't explain how it was done.
> 
> https://mail.python.org/pipermail/mailman-users/2002-February/017906.html


I looked at the posts in that thread, and as you, I see nothing about
how it was done. Further, I don't see how this can be done in
Defaults.py/mm_cfg.py short of some very complex 'patch the archiver on
the fly' kind of coding if it can be done at all.

Are you talking about just the various date sequence index (date.html)
files or do you also want the messages for each author in the author
index, the messages for each subject in the subject index and the
threads in the thread index also in reverse? For threads, you would
presumably want them ordered by the date of the most recent post in the
thread.

The pipermail archiver is the most difficult code in all of Mailman 2.1
to understand and follow. It may be possible to accomplish this, and the
ultimate patch might be simple, but I don't think it would be too easy
to figure it out.

-- 
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter 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/archive%40jab.org


[Mailman-Users] Reverse chronological date order for archives

2015-11-18 Thread ListGnome ProtonMail via Mailman-Users
Hi,

Has anyone been able to order their archive messages in reverse chronological 
date order - so the most recent post is at the top of the page. (Version 2.1.20)

I found a related thread in the Mailman-Users archive (dated 2002) but it 
didn't explain how it was done.

https://mail.python.org/pipermail/mailman-users/2002-February/017906.html

Any clues greatly appreciated.

Cheers,
Mark
--
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/archive%40jab.org


Re: [Mailman-Users] Reverse chronological date order for archives

2015-11-18 Thread Mark Sapiro
On 11/18/15 7:03 PM, ListGnome ProtonMail wrote:
> Hi Mark,
> 
> I was referring to the date.html page - but it would also apply to all
> the other views - whereby the most recent post is always at the top
> rather than the bottom.
> 
> I found another post (from 2004) where the author modified the
> HyperDatabase.py file and says that managed to reverse the chronological
> date order.
> 
> https://www.mail-archive.com/mailman-users%40python.org/msg28944.html
> 
> I had a look at the HyperDatabase.py file in my version (2.1.20) and the
> code that he shows doesn't exist in my file.
...


The patch in that post is against Mailman 2.1.5. The reason you can't
find that code in any HyperDatabase.py is the patch is 'reversed' and
the lines that show as deleted were actually added. A proper context
diff for that patch is

$ diff -u HyperDatabase.py.old HyperDatabase.py
--- HyperDatabase.py.old2015-11-18 22:15:25.0 -0800
+++ HyperDatabase.py2015-11-18 22:20:43.0 -0800
@@ -291,9 +291,14 @@

 def first(self, archive, index):
 self.__openIndices(archive)
+if index == 'date': dateIndex = 1
+else: dateIndex = 0
 index = getattr(self, index + 'Index')
 try:
 key, msgid = index.first()
+if dateIndex == 1:
+index.sorted.reverse()
+key, msgid = index.first()
 return msgid
 except KeyError:
 return None

And the patch refactored for style against 2.1.20 is

$ diff -u 2.1/Mailman/Archiver/HyperDatabase.py
21/Mailman/Archiver/HyperDatabase.py
--- 2.1/Mailman/Archiver/HyperDatabase.py   2013-05-31 14:44:32.0
-0700
+++ 21/Mailman/Archiver/HyperDatabase.py2015-11-18 22:32:14.0 
-0800
@@ -297,8 +297,14 @@

 def first(self, archive, index):
 self.__openIndices(archive)
+if index == 'date':
+dateIndex = 1
+else:
+dateIndex = 0
 index = getattr(self, index + 'Index')
 try:
+if dateIndex == 1:
+index.sorted.reverse()
 key, msgid = index.first()
 return msgid
 except KeyError:


I note three things.
1) I have not tested the patch. It looks like it might work, but no
guarantees.
2) The patch only affects the date index.
3) After installing the patch and restarting Mailman, the current period
date index for a list should be reordered with the next post to that
list, but older date index files will not be unless you rebuild the
archive with bin/arch --wipe. See the section "NOTE ON MBOX ANOMALIES:"
in the FAQ at  for caveats before doing
this.

-- 
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter 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/archive%40jab.org