remove seemingly old useless ed
[mharc.git] / mp / yyz.py
1 # handle the reply button when a message is displayed in the list archive.
2 # Copyright (C) 2020 Free Software Foundation
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18
19 # iank: file had a date of 2002 on it. This
20
21
22 ## apache has this related configuration (this is duplicated in fsf ansible)
23 # Alias /mp/ /home/mharc/mp/
24 # <Directory /home/mharc/mp>
25 # AddHandler python-program .py
26 # PythonHandler yyz
27 # PythonDebug on
28 # </Directory>
29
30 from mod_python import apache, util
31 from urllib import quote
32
33 def handler (req):
34 if req.method != 'POST' or \
35 not req.headers_in.has_key ('content-type') or \
36 req.headers_in['content-type'][:10] != 'multipart/':
37 return apache.HTTP_NOT_FOUND
38
39 form = util.FieldStorage (req)
40 if form.has_key ('a') and form.has_key ('b') and \
41 form.has_key ('c') and form.has_key ('d'):
42 req.headers_out.add ('Location',
43 'mailto:%s@%s?In-Reply-To=%s&Subject=%s' \
44 % (quote(form['a']), quote(form['c']),
45 quote(form['d']), quote(form['b'])))
46
47 return apache.HTTP_MOVED_TEMPORARILY
48
49 return apache.HTTP_NOT_FOUND