/[qa]/trunk/pts/www/cgi-bin/pts.cgi
ViewVC logotype

Contents of /trunk/pts/www/cgi-bin/pts.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 475 - (hide annotations) (download)
Sun Jan 5 16:47:13 2003 UTC (10 years, 4 months ago) by hertzog
File size: 2372 byte(s)
- Add the "ddtp" keyword.
1 hertzog 382 #!/usr/bin/python
2     # vim: expandtab
3    
4     # Copyright 2002 Raphaël Hertzog
5     # Available under the terms of the General Public License version 2
6     # or (at your option) any later version.
7    
8     import cgi, urllib, sys, smtplib, string
9     #import cgitb; cgitb.enable()
10    
11     form = cgi.FieldStorage()
12     pkg = ""
13     addr = ""
14     what = ""
15     advanced = ""
16     if form.has_key("package"): pkg = form["package"].value
17     if form.has_key("email"): addr = form["email"].value
18     if form.has_key("what"): what = form["what"].value
19     if form.has_key("advanced"): advanced = form["advanced"].value
20     command = ""
21    
22     if string.find(addr, "@") == -1:
23     print "Content-Type: text/html"
24     print
25 hertzog 447 print "<html><body><h2 style='color:red'>The submitted email address is invalid : " + addr + "</h2></body></html>"
26 hertzog 382 sys.exit(0)
27    
28     if what == "subscribe":
29     command = "subscribe %s %s\n" % (pkg, addr)
30     elif what == "unsubscribe":
31     command = "unsubscribe %s %s\n" % (pkg, addr)
32     elif what == "advanced":
33     f = open("subscription.html", "r")
34     print "Content-Type: text/html"
35     print
36     while 1:
37     line = f.readline()
38     if not line: break #eof
39     line = string.replace(line,"#PKG#", pkg)
40     line = string.replace(line, "#EMAIL#", addr)
41     print line,
42     sys.exit(0)
43     else:
44     sys.exit(1)
45    
46     if advanced:
47     # Add all tags treatment
48     command = command + "keyword %s %s =" % (pkg, addr)
49 hertzog 475 for tag in ["bts", "bts-control", "upload-source", "upload-binary", "katie-other", "summary", "default", "cvs", "ddtp"]:
50 hertzog 382 choice = ""
51     if form.has_key("kw_" + tag): choice = form["kw_" + tag].value
52     if choice:
53     command = command + " " + tag
54     command = command + "\n"
55    
56     msg = """From: PTS Web Subscriber <%s>
57     To: PTS Mailbot <pts@qa.debian.org>
58     Subject: Web subscription for %s package
59    
60     %s""" % (addr, pkg, command)
61    
62     smtp = smtplib.SMTP()
63     smtp.connect()
64     smtp.sendmail("owner@packages.qa.debian.org", ["pts@qa.debian.org"], msg)
65     smtp.quit()
66    
67     print "Content-Type: text/html"
68     print
69     print "<html><head><title>Command processed</title></head><body>"
70     print "<h1>Command processed</h1>"
71     print "<p>Your command has been sent to the Package Tracking System mailbot"
72     print "with the following mail :"
73     print "<blockquote><pre>"
74     print cgi.escape(msg)
75     print "</pre></blockquote>"
76     print "You will soon receive a confirmation mail, please read it carefully."
77     print "</body></html>"
78    

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5