=== modified file 'Mailman/Cgi/admindb.py' --- Mailman/Cgi/admindb.py 2018-06-17 23:47:34 +0000 +++ Mailman/Cgi/admindb.py 2019-01-31 19:34:24 +0000 @@ -715,6 +715,8 @@ chars = 0 # A negative value means, include the entire message regardless of size limit = mm_cfg.ADMINDB_PAGE_TEXT_LIMIT + if mm_cfg.HOLD_MESSAGES_AS_PICKLES == 0: + limit = -1 for line in email.Iterators.body_line_iterator(msg, decode=True): lines.append(line) chars += len(line) @@ -787,12 +789,12 @@ t.AddCellInfo(row, col-1, align='right') t.AddRow([Bold(_('Message Headers:')), TextArea('headers-%d' % id, hdrtxt, - rows=EXCERPT_HEIGHT, cols=EXCERPT_WIDTH, readonly=1)]) + rows=EXCERPT_HEIGHT, cols=EXCERPT_WIDTH, readonly=0)]) row, col = t.GetCurrentRowIndex(), t.GetCurrentCellIndex() t.AddCellInfo(row, col-1, align='right') t.AddRow([Bold(_('Message Excerpt:')), TextArea('fulltext-%d' % id, Utils.websafe(body), - rows=EXCERPT_HEIGHT, cols=EXCERPT_WIDTH, readonly=1)]) + rows=EXCERPT_HEIGHT, cols=EXCERPT_WIDTH, readonly=0)]) t.AddCellInfo(row+1, col-1, align='right') form.AddItem(t) form.AddItem('

') @@ -914,6 +916,8 @@ continue # Get the action comment and reasons if present. commentkey = 'comment-%d' % request_id + headerskey = 'headers-%d' % request_id + fulltextkey = 'fulltext-%d' % request_id preservekey = 'preserve-%d' % request_id forwardkey = 'forward-%d' % request_id forwardaddrkey = 'forward-addr-%d' % request_id @@ -932,8 +936,14 @@ preserve = 0 forward = 0 forwardaddr = '' + headers = '' + fulltext = '' if cgidata.has_key(commentkey): comment = cgidata[commentkey].value + if cgidata.has_key(headerskey): + headers = cgidata[headerskey].value + if cgidata.has_key(fulltextkey): + fulltext = cgidata[fulltextkey].value if cgidata.has_key(preservekey): preserve = cgidata[preservekey].value if cgidata.has_key(forwardkey): @@ -951,7 +961,7 @@ # Handle the request id try: mlist.HandleRequest(request_id, v, comment, - preserve, forward, forwardaddr) + preserve, forward, forwardaddr, headers, fulltext) except (KeyError, Errors.LostHeldMessage): # That's okay, it just means someone else has already updated the # database while we were staring at the page, so just ignore it === modified file 'Mailman/ListAdmin.py' --- Mailman/ListAdmin.py 2018-06-18 11:35:51 +0000 +++ Mailman/ListAdmin.py 2019-01-31 19:22:32 +0000 @@ -44,6 +44,8 @@ from Mailman.Logging.Syslog import syslog from Mailman import i18n +import string + _ = i18n._ def D_(s): return s @@ -161,12 +163,12 @@ return type def HandleRequest(self, id, value, comment=None, preserve=None, - forward=None, addr=None): + forward=None, addr=None, headers=None, fulltext=None): self.__opendb() rtype, data = self.__db[id] if rtype == HELDMSG: status = self.__handlepost(data, value, comment, preserve, - forward, addr) + forward, addr, headers, fulltext) elif rtype == UNSUBSCRIPTION: status = self.__handleunsubscription(data, value, comment) else: @@ -229,10 +231,36 @@ self.__db[id] = (HELDMSG, data) return id - def __handlepost(self, record, value, comment, preserve, forward, addr): + def __handlepost(self, record, value, comment, preserve, forward, addr, headers, fulltext): # For backwards compatibility with pre 2.0beta3 ptime, sender, subject, reason, filename, msgdata = record path = os.path.join(mm_cfg.DATA_DIR, filename) + # Handle editing - you must set HOLD_MESSAGES_AS_PICKLES = 0 in the config. + if (headers or fulltext) and not mm_cfg.HOLD_MESSAGES_AS_PICKLES: + # Read held message in + try: + fp = open(path) + except IOError, e: + if e.errno <> errno.ENOENT: raise + return LOST + try: + rawmsg = fp.read() + finally: + fp.close() + # Parse headers and body + parts = string.split(rawmsg,'\n\n') + if len(headers) == 0: + headers = parts[0] + if len(fulltext) == 0: + fulltext = parts[1] + rawmsg = headers + '\n\n' + fulltext + # Write it out again to held file + try: + fp = open(path, 'w') + fp.write(rawmsg) + finally: + if fp: + fp.close() # Handle message preservation if preserve: parts = os.path.split(path)[1].split(DASH)