[Mailman-Users] Config for moderator to edit posts in admindb

Jon Carnes jonc at haht.com
Mon Feb 25 22:24:50 CET 2002


Google search turned up:

http://mail.python.org/pipermail/mailman-developers/2001-October/009686.html

This was written for Mailman v2.0.6
===
*** Mailman/Cgi/admindb.py.orig Wed Oct 10 13:31:46 2001
--- Mailman/Cgi/admindb.py      Wed Oct 10 18:30:25 2001
***************
*** 270,275 ****
--- 270,277 ----
              continue
          # get the action comment and reasons if present
          commentkey = 'comment-%d' % request_id
+         headerskey = 'headers-%d' % request_id
+         contentskey = 'fulltext-%d' % request_id
          preservekey = 'preserve-%d' % request_id
          forwardkey = 'forward-%d' % request_id
          forwardaddrkey = 'forward-addr-%d' % request_id
***************
*** 278,285 ****
--- 280,293 ----
          preserve = 0
          forward = 0
          forwardaddr = ''
+         headers = ''
+         contents = ''
          if cgidata.has_key(commentkey):
              comment = cgidata[commentkey].value
+         if cgidata.has_key(headerskey):
+             headers = cgidata[headerskey].value
+         if cgidata.has_key(contentskey):
+             contents = cgidata[contentskey].value
          if cgidata.has_key(preservekey):
              preserve = cgidata[preservekey].value
          if cgidata.has_key(forwardkey):
***************
*** 290,296 ****
          # handle the request id
          try:
              mlist.HandleRequest(request_id, v, comment,
!                                 preserve, forward, forwardaddr)
          except (KeyError, Errors.LostHeldMessage):
              # that's okay, it just means someone else has already updated
the
              # database, so just ignore this id
--- 298,304 ----
          # handle the request id
          try:
              mlist.HandleRequest(request_id, v, comment,
!                                 preserve, forward, forwardaddr, headers,
contents)
          except (KeyError, Errors.LostHeldMessage):
              # that's okay, it just means someone else has already updated
the
              # database, so just ignore this id
*** Mailman/ListAdmin.py.orig   Wed Oct 10 13:31:46 2001
--- Mailman/ListAdmin.py        Wed Oct 10 18:40:27 2001
***************
*** 122,133 ****
          return type

      def HandleRequest(self, id, value, comment=None, preserve=None,
!                       forward=None, addr=None):
          self.__opendb()
          rtype, data = self.__db[id]
          if rtype == HELDMSG:
              status = self.__handlepost(data, value, comment, preserve,
!                                        forward, addr)
          else:
              assert rtype == SUBSCRIPTION
              status = self.__handlesubscription(data, value, comment)
--- 122,133 ----
          return type

      def HandleRequest(self, id, value, comment=None, preserve=None,
!                       forward=None, addr=None, headers=None,
contents=None):
          self.__opendb()
          rtype, data = self.__db[id]
          if rtype == HELDMSG:
              status = self.__handlepost(data, value, comment, preserve,
!                                        forward, addr, headers, contents)
          else:
              assert rtype == SUBSCRIPTION
              status = self.__handlesubscription(data, value, comment)
***************
*** 172,178 ****
          data = time.time(), sender, msgsubject, reason, filename, msgdata
          self.__db[id] = (HELDMSG, data)

!     def __handlepost(self, record, value, comment, preserve, forward,
addr):
          # For backwards compatibility with pre 2.0beta3
          if len(record) == 5:
              ptime, sender, subject, reason, filename = record
--- 172,178 ----
          data = time.time(), sender, msgsubject, reason, filename, msgdata
          self.__db[id] = (HELDMSG, data)

!     def __handlepost(self, record, value, comment, preserve, forward,
addr, headers, contents):
          # For backwards compatibility with pre 2.0beta3
          if len(record) == 5:
              ptime, sender, subject, reason, filename = record
***************
*** 181,186 ****
--- 181,202 ----
              # New format of record
              ptime, sender, subject, reason, filename, msgdata = record
          path = os.path.join(mm_cfg.DATA_DIR, filename)
+         # Handle editing
+         if len(headers)+len(contents):
+            fp = open(path)
+            unixfrom = fp.readline()
+            rest = fp.read()
+            # Parse headers and body
+            parts = string.split(rest,'\n\n')
+            if len(headers) == 0:
+                headers = parts[0]
+            if len(contents) == 0:
+                contents = parts[1]
+            fp.close
+            # Now write the changed result
+            fp = open(path,'w')
+            fp.write(unixfrom + headers + '\n\n' + contents)
+            fp.close
          # Handle message preservation
          if preserve:
              parts = string.split(os.path.split(path)[1], '-')



===
----- Original Message -----
From: "Kirez Korgan" <kirez at cornell.edu>
To: "Jon Carnes" <jonc at haht.com>; <Mailman-Users at python.org>
Sent: Monday, February 25, 2002 2:21 PM
Subject: Re: [Mailman-Users] Config for moderator to edit posts in admindb


> How do I find and install, or re-create, this patch that someone else made
> to allow the admin to edit the copy of the message and then replace the
> original message with the copy?
>
> Kirez
>
>
> ----- Original Message -----
> From: "Jon Carnes" <jonc at haht.com>
> To: "Kirez Korgan" <kirez at cornell.edu>; <Mailman-Users at python.org>
> Sent: Monday, February 25, 2002 1:02 PM
> Subject: Re: [Mailman-Users] Config for moderator to edit posts in admindb
>
>
> > Yes.  Mailman is open source software and is very easy to modify.
Someone
> > has already made a patch that does exactly that (allows the admin to
> > view/edit the copy of the message, and then replaces the original
message
> > with the copy).
> >
> > The original message is in ~mailman/held/..
> > Each message is stored in a file of the form: heldmsg-<list_name>-xxxx
> >
> > If you don't want to hack Mailman, you can let your admins edit the
files
> > directly.  You can link this directory to a common access point and give
> > your admins rights to it (or you can mount it via samba...).  Then your
> > admins can easily edit the messages directly.
> >
> > Jon Carnes
> > ----- Original Message -----
> > From: "Kirez Korgan" <kirez at cornell.edu>
> > To: <Mailman-Users at python.org>
> > Sent: Monday, February 25, 2002 1:34 PM
> > Subject: [Mailman-Users] Config for moderator to edit posts in admindb
> >
> >
> > > It seems that Mailman makes a copy of a message appear in the admindb,
> for
> > > moderators to process (accept or reject).
> > >
> > > My moderators want to EDIT the message, however.
> > >
> > > Is it possible to config Mailman so that they can edit the message
> through
> > > the admindb / viewer?
> > >
> > > cheers,
> > > Kirez
> > >
> > >
> > > ------------------------------------------------------
> > > Mailman-Users maillist  -  Mailman-Users at python.org
> > > http://mail.python.org/mailman/listinfo/mailman-users
> >





More information about the Mailman-Users mailing list