[Mailman-Developers] small patch for admindb.py

Ricardo Kustner ricardo@rixhq.nu
Mon, 17 Jan 2000 23:02:35 +0100


Below is a small patch for Mailman/Cgi/admindb.py (latest 1.2 cvs) to 
seperate the message header for the body of messages
that are being held for approval, so it makes it much easier to 
read the messages... some people might want to be able to see
the message headers anyway, so maybe it could be made as an config option?
it could be that there's some function in the MM code somewhere that
does the same, but since my knowledge is limited to admindb.py, this
is all i could think of (I'm still waiting for some sort of Oreilly "Mailman
Developers Guide in nutshell" book to be released ;) )
this patch only shows the message body... I tried putting the 
header in a html <SELECT> box (so clicking it would expand the list), but 
that didn't turn out as i expected...

Ricardo.

*** admindb.py	Mon Jan 17 22:24:17 2000
--- /usr/local/cvs/mailman/Mailman/Cgi/admindb.py	Mon Nov 15 23:29:46 1999
***************
*** 195,212 ****
      form.AddItem(Center(Header(2, msg)))
      try:
          fp = open(os.path.join(mm_cfg.DATA_DIR, filename))
!         # text = fp.read(mm_cfg.ADMINDB_PAGE_TEXT_LIMIT)
! 	msg_header = ""
! 	msg_body = ""
! 	for line in fp.readlines():
! 		if msg_body == "":
! 			if line != "\n":
! 				msg_header = msg_header + line
! 			else:
! 				msg_body = line
! 		else:
! 			msg_body = msg_body + line	
! 
          fp.close()
      except IOError, (code, msg):
          if code == ENOENT:
--- 195,201 ----
      form.AddItem(Center(Header(2, msg)))
      try:
          fp = open(os.path.join(mm_cfg.DATA_DIR, filename))
!         text = fp.read(mm_cfg.ADMINDB_PAGE_TEXT_LIMIT)
          fp.close()
      except IOError, (code, msg):
          if code == ENOENT:
***************
*** 241,247 ****
      row, col = t.GetCurrentRowIndex(), t.GetCurrentCellIndex()
      t.AddCellInfo(row, col, colspan=3)
      t.AddRow([Bold('Message Excerpt:'),
!               TextArea('fulltext-%d' % id, msg_body, rows=10, cols=60)])
      row, col = t.GetCurrentRowIndex(), t.GetCurrentCellIndex()
      t.AddCellInfo(row, col, colspan=3)
      form.AddItem(t)
--- 230,236 ----
      row, col = t.GetCurrentRowIndex(), t.GetCurrentCellIndex()
      t.AddCellInfo(row, col, colspan=3)
      t.AddRow([Bold('Message Excerpt:'),
!               TextArea('fulltext-%d' % id, text, rows=10, cols=60)])
      row, col = t.GetCurrentRowIndex(), t.GetCurrentCellIndex()
      t.AddCellInfo(row, col, colspan=3)
      form.AddItem(t)