Mercurial > p > roundup > code
annotate roundup-server @ 302:d1fb3fcdb11b
Catch errors in login - no username or password supplied.
Fixed editing of password (Password property type) thanks Roch'e Compaan.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sat, 20 Oct 2001 11:58:48 +0000 |
| parents | 8230a9a62794 |
| children | 96212178c175 |
| rev | line source |
|---|---|
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1 #!/usr/bin/python |
|
213
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
2 # |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
3 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/) |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
4 # This module is free software, and you may redistribute it and/or modify |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
5 # under the same terms as Python, so long as this copyright message and |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
6 # disclaimer are retained in their original form. |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
7 # |
| 214 | 8 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR |
|
213
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
9 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
10 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
11 # POSSIBILITY OF SUCH DAMAGE. |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
12 # |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
13 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
18 # |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
19 """ HTTP Server that serves roundup. |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
20 |
|
213
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
21 Based on CGIHTTPServer in the Python library. |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
22 |
|
290
8230a9a62794
Didn't clean up after myself :)
Richard Jones <richard@users.sourceforge.net>
parents:
288
diff
changeset
|
23 $Id: roundup-server,v 1.15 2001-10-12 02:23:26 richard Exp $ |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
24 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
25 """ |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
26 import sys |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
27 if int(sys.version[0]) < 2: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
28 print "Content-Type: text/plain\n" |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
29 print "Roundup requires Python 2.0 or newer." |
|
32
b475e7d3ce52
actually quit if python version wrong
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
27
diff
changeset
|
30 sys.exit(0) |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
31 |
|
190
996eaf90c01e
Instance import now imports the instance using imp.load_module...
Richard Jones <richard@users.sourceforge.net>
parents:
127
diff
changeset
|
32 import os, urllib, StringIO, traceback, cgi, binascii, string, getopt, imp |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
33 import BaseHTTPServer |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
34 import SimpleHTTPServer |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
35 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
36 # Roundup modules of use here |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
37 from roundup import cgitb, cgi_client |
|
204
c1461733cbf9
Instances are now opened by a special function...
Richard Jones <richard@users.sourceforge.net>
parents:
193
diff
changeset
|
38 import roundup.instance |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
39 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
40 # |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
41 ## Configuration |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
42 # |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
43 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
44 # This indicates where the Roundup instance lives |
|
52
33bfce110d1e
Fixed the ROUNDUPS decl in roundup-server
Richard Jones <richard@users.sourceforge.net>
parents:
32
diff
changeset
|
45 ROUNDUP_INSTANCE_HOMES = { |
|
54
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
46 'bar': '/tmp/bar', |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
47 } |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
48 |
|
288
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
49 ROUNDUP_USER = None |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
50 |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
51 |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
52 # Where to log debugging information to. Use an instance of DevNull if you |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
53 # don't want to log anywhere. |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
54 # TODO: actually use this stuff |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
55 #class DevNull: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
56 # def write(self, info): |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
57 # pass |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
58 #LOG = open('/var/log/roundup.cgi.log', 'a') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
59 #LOG = DevNull() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
60 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
61 # |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
62 ## end configuration |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
63 # |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
64 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
65 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
66 class RoundupRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): |
|
61
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
67 ROUNDUP_INSTANCE_HOMES = ROUNDUP_INSTANCE_HOMES |
|
288
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
68 ROUNDUP_USER = ROUNDUP_USER |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
69 def send_head(self): |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
70 """Version of send_head that support CGI scripts""" |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
71 # TODO: actually do the HEAD ... |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
72 return self.run_cgi() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
73 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
74 def run_cgi(self): |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
75 """ Execute the CGI command. Wrap an innner call in an error |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
76 handler so all errors can be caught. |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
77 """ |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
78 save_stdin = sys.stdin |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
79 sys.stdin = self.rfile |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
80 try: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
81 self.inner_run_cgi() |
|
264
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
82 except cgi_client.NotFound: |
|
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
83 self.send_error(404, self.path) |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
84 except cgi_client.Unauthorised: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
85 self.wfile.write('Content-Type: text/html\n') |
|
264
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
86 self.wfile.write('Status: 403\n\n') |
|
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
87 self.wfile.write('You are not authorised to access this URL.') |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
88 except: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
89 try: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
90 reload(cgitb) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
91 self.wfile.write("Content-Type: text/html\n\n") |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
92 self.wfile.write(cgitb.breaker()) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
93 self.wfile.write(cgitb.html()) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
94 except: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
95 self.wfile.write("Content-Type: text/html\n\n") |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
96 self.wfile.write("<pre>") |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
97 s = StringIO.StringIO() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
98 traceback.print_exc(None, s) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
99 self.wfile.write(cgi.escape(s.getvalue())) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
100 self.wfile.write("</pre>\n") |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
101 sys.stdin = save_stdin |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
102 |
|
252
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
103 def index(self): |
|
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
104 ''' Print up an index of the available instances |
|
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
105 ''' |
|
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
106 w = self.wfile.write |
|
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
107 w("Content-Type: text/html\n\n") |
|
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
108 w('<html><head><title>Roundup instances index</title><head>\n') |
|
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
109 w('<body><h1>Roundup instances index</h1><ol>\n') |
|
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
110 for instance in self.ROUNDUP_INSTANCE_HOMES.keys(): |
|
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
111 w('<li><a href="%s/index">%s</a>\n'%(urllib.quote(instance), |
|
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
112 instance)) |
|
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
113 w('</ol></body></html>') |
|
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
114 |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
115 def inner_run_cgi(self): |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
116 ''' This is the inner part of the CGI handling |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
117 ''' |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
118 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
119 rest = self.path |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
120 i = rest.rfind('?') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
121 if i >= 0: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
122 rest, query = rest[:i], rest[i+1:] |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
123 else: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
124 query = '' |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
125 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
126 # figure the instance |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
127 if rest == '/': |
|
252
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
128 return self.index() |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
129 l_path = string.split(rest, '/') |
|
264
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
130 instance_name = urllib.unquote(l_path[1]) |
|
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
131 if self.ROUNDUP_INSTANCE_HOMES.has_key(instance_name): |
|
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
132 instance_home = self.ROUNDUP_INSTANCE_HOMES[instance_name] |
|
204
c1461733cbf9
Instances are now opened by a special function...
Richard Jones <richard@users.sourceforge.net>
parents:
193
diff
changeset
|
133 instance = roundup.instance.open(instance_home) |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
134 else: |
|
264
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
135 raise cgi_client.NotFound |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
136 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
137 # figure out what the rest of the path is |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
138 if len(l_path) > 2: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
139 rest = '/'.join(l_path[2:]) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
140 else: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
141 rest = '/' |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
142 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
143 # Set up the CGI environment |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
144 env = {} |
|
264
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
145 env['INSTANCE_NAME'] = instance_name |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
146 env['REQUEST_METHOD'] = self.command |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
147 env['PATH_INFO'] = urllib.unquote(rest) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
148 if query: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
149 env['QUERY_STRING'] = query |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
150 host = self.address_string() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
151 if self.headers.typeheader is None: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
152 env['CONTENT_TYPE'] = self.headers.type |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
153 else: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
154 env['CONTENT_TYPE'] = self.headers.typeheader |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
155 length = self.headers.getheader('content-length') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
156 if length: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
157 env['CONTENT_LENGTH'] = length |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
158 co = filter(None, self.headers.getheaders('cookie')) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
159 if co: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
160 env['HTTP_COOKIE'] = ', '.join(co) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
161 env['SCRIPT_NAME'] = '' |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
162 env['SERVER_NAME'] = self.server.server_name |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
163 env['SERVER_PORT'] = str(self.server.server_port) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
164 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
165 decoded_query = query.replace('+', ' ') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
166 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
167 # reload all modules |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
168 # TODO check for file timestamp changes and dependencies |
|
54
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
169 #reload(date) |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
170 #reload(hyperdb) |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
171 #reload(roundupdb) |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
172 #reload(htmltemplate) |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
173 #reload(cgi_client) |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
174 #sys.path.insert(0, module_path) |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
175 #try: |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
176 # reload(instance) |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
177 #finally: |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
178 # del sys.path[0] |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
179 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
180 self.send_response(200, "Script output follows") |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
181 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
182 # do the roundup thang |
|
264
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
183 client = instance.Client(instance, self.wfile, env) |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
184 client.main() |
|
264
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
185 |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
186 do_POST = run_cgi |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
187 |
|
61
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
188 def usage(message=''): |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
189 if message: message = 'Error: %s\n'%message |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
190 print '''%sUsage: |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
191 roundup-server [-n hostname] [-p port] [name=instance home]* |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
192 |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
193 -n: sets the host name |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
194 -p: sets the port to listen on |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
195 |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
196 name=instance home |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
197 Sets the instance home(s) to use. The name is how the instance is |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
198 identified in the URL (it's the first part of the URL path). The |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
199 instance home is the directory that was identified when you did |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
200 "roundup-admin init". You may specify any number of these name=home |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
201 pairs on the command-line. For convenience, you may edit the |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
202 ROUNDUP_INSTANCE_HOMES variable in the roundup-server file instead. |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
203 '''%message |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
204 sys.exit(0) |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
205 |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
206 def main(): |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
207 hostname = '' |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
208 port = 8080 |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
209 try: |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
210 # handle the command-line args |
|
288
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
211 optlist, args = getopt.getopt(sys.argv[1:], 'n:p:u:') |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
212 user = ROUNDUP_USER |
|
61
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
213 for (opt, arg) in optlist: |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
214 if opt == '-n': hostname = arg |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
215 elif opt == '-p': port = int(arg) |
|
288
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
216 elif opt == '-u': user = arg |
|
61
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
217 elif opt == '-h': usage() |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
218 |
|
288
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
219 # if root, setuid to the running user |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
220 if not os.getuid() and user is not None: |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
221 try: |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
222 import pwd |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
223 except ImportError: |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
224 raise ValueError, "Can't change users - no pwd module" |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
225 try: |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
226 uid = pwd.getpwnam(user)[2] |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
227 except KeyError: |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
228 raise ValueError, "User %s doesn't exist"%user |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
229 os.setuid(uid) |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
230 elif os.getuid() and user is not None: |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
231 print 'WARNING: ignoring "-u" argument, not root' |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
232 |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
233 # People can remove this check if they're really determined |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
234 if not os.getuid() and user is None: |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
235 raise ValueError, "Can't run as root!" |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
236 |
|
61
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
237 # handle instance specs |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
238 if args: |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
239 d = {} |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
240 for arg in args: |
|
288
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
241 try: |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
242 name, home = string.split(arg, '=') |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
243 except ValueError: |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
244 raise ValueError, "Instances must be name=home" |
|
61
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
245 d[name] = home |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
246 RoundupRequestHandler.ROUNDUP_INSTANCE_HOMES = d |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
247 except: |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
248 type, value = sys.exc_info()[:2] |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
249 usage('%s: %s'%(type, value)) |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
250 |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
251 # we don't want the cgi module interpreting the command-line args ;) |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
252 sys.argv = sys.argv[:1] |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
253 address = (hostname, port) |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
254 httpd = BaseHTTPServer.HTTPServer(address, RoundupRequestHandler) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
255 print 'Roundup server started on', address |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
256 httpd.serve_forever() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
257 |
|
61
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
258 if __name__ == '__main__': |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
259 main() |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
260 |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
261 # |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
262 # $Log: not supported by cvs2svn $ |
|
290
8230a9a62794
Didn't clean up after myself :)
Richard Jones <richard@users.sourceforge.net>
parents:
288
diff
changeset
|
263 # Revision 1.14 2001/10/12 02:20:32 richard |
|
8230a9a62794
Didn't clean up after myself :)
Richard Jones <richard@users.sourceforge.net>
parents:
288
diff
changeset
|
264 # server now handles setuid'ing much better |
|
8230a9a62794
Didn't clean up after myself :)
Richard Jones <richard@users.sourceforge.net>
parents:
288
diff
changeset
|
265 # |
|
288
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
266 # Revision 1.13 2001/10/05 02:23:24 richard |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
267 # . roundup-admin create now prompts for property info if none is supplied |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
268 # on the command-line. |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
269 # . hyperdb Class getprops() method may now return only the mutable |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
270 # properties. |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
271 # . Login now uses cookies, which makes it a whole lot more flexible. We can |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
272 # now support anonymous user access (read-only, unless there's an |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
273 # "anonymous" user, in which case write access is permitted). Login |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
274 # handling has been moved into cgi_client.Client.main() |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
275 # . The "extended" schema is now the default in roundup init. |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
276 # . The schemas have had their page headings modified to cope with the new |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
277 # login handling. Existing installations should copy the interfaces.py |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
278 # file from the roundup lib directory to their instance home. |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
279 # . Incorrectly had a Bizar Software copyright on the cgitb.py module from |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
280 # Ping - has been removed. |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
281 # . Fixed a whole bunch of places in the CGI interface where we should have |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
282 # been returning Not Found instead of throwing an exception. |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
283 # . Fixed a deviation from the spec: trying to modify the 'id' property of |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
284 # an item now throws an exception. |
|
c2f287327ca8
server now handles setuid'ing much better
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
285 # |
|
264
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
286 # Revision 1.12 2001/09/29 13:27:00 richard |
|
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
287 # CGI interfaces now spit up a top-level index of all the instances they can |
|
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
288 # serve. |
|
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
252
diff
changeset
|
289 # |
|
252
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
290 # Revision 1.11 2001/08/07 00:24:42 richard |
|
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
291 # stupid typo |
|
76c6994aa4e8
CGI interfaces now spit up a top-level index of all instances they can serve.
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
292 # |
| 214 | 293 # Revision 1.10 2001/08/07 00:15:51 richard |
| 294 # Added the copyright/license notice to (nearly) all files at request of | |
| 295 # Bizar Software. | |
| 296 # | |
|
213
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
297 # Revision 1.9 2001/08/05 07:44:36 richard |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
298 # Instances are now opened by a special function that generates a unique |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
299 # module name for the instances on import time. |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
300 # |
|
204
c1461733cbf9
Instances are now opened by a special function...
Richard Jones <richard@users.sourceforge.net>
parents:
193
diff
changeset
|
301 # Revision 1.8 2001/08/03 01:28:33 richard |
|
c1461733cbf9
Instances are now opened by a special function...
Richard Jones <richard@users.sourceforge.net>
parents:
193
diff
changeset
|
302 # Used the much nicer load_package, pointed out by Steve Majewski. |
|
c1461733cbf9
Instances are now opened by a special function...
Richard Jones <richard@users.sourceforge.net>
parents:
193
diff
changeset
|
303 # |
|
193
241a0323aacb
Used the much nicer load_package, pointed out by Steve Majewski.
Richard Jones <richard@users.sourceforge.net>
parents:
190
diff
changeset
|
304 # Revision 1.7 2001/08/03 00:59:34 richard |
|
241a0323aacb
Used the much nicer load_package, pointed out by Steve Majewski.
Richard Jones <richard@users.sourceforge.net>
parents:
190
diff
changeset
|
305 # Instance import now imports the instance using imp.load_module so that |
|
241a0323aacb
Used the much nicer load_package, pointed out by Steve Majewski.
Richard Jones <richard@users.sourceforge.net>
parents:
190
diff
changeset
|
306 # we can have instance homes of "roundup" or other existing python package |
|
241a0323aacb
Used the much nicer load_package, pointed out by Steve Majewski.
Richard Jones <richard@users.sourceforge.net>
parents:
190
diff
changeset
|
307 # names. |
|
241a0323aacb
Used the much nicer load_package, pointed out by Steve Majewski.
Richard Jones <richard@users.sourceforge.net>
parents:
190
diff
changeset
|
308 # |
|
190
996eaf90c01e
Instance import now imports the instance using imp.load_module...
Richard Jones <richard@users.sourceforge.net>
parents:
127
diff
changeset
|
309 # Revision 1.6 2001/07/29 07:01:39 richard |
|
996eaf90c01e
Instance import now imports the instance using imp.load_module...
Richard Jones <richard@users.sourceforge.net>
parents:
127
diff
changeset
|
310 # Added vim command to all source so that we don't get no steenkin' tabs :) |
|
996eaf90c01e
Instance import now imports the instance using imp.load_module...
Richard Jones <richard@users.sourceforge.net>
parents:
127
diff
changeset
|
311 # |
|
127
0791d13baea7
Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents:
61
diff
changeset
|
312 # Revision 1.5 2001/07/24 01:07:59 richard |
|
0791d13baea7
Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents:
61
diff
changeset
|
313 # Added command-line arg handling to roundup-server so it's more useful |
|
0791d13baea7
Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents:
61
diff
changeset
|
314 # out-of-the-box. |
|
0791d13baea7
Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents:
61
diff
changeset
|
315 # |
|
61
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
316 # Revision 1.4 2001/07/23 10:31:45 richard |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
317 # disabled the reloading until it can be done properly |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
318 # |
|
54
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
319 # Revision 1.3 2001/07/23 08:53:44 richard |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
320 # Fixed the ROUNDUPS decl in roundup-server |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
321 # Move the installation notes to INSTALL |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
322 # |
|
52
33bfce110d1e
Fixed the ROUNDUPS decl in roundup-server
Richard Jones <richard@users.sourceforge.net>
parents:
32
diff
changeset
|
323 # Revision 1.2 2001/07/23 04:05:05 anthonybaxter |
|
33bfce110d1e
Fixed the ROUNDUPS decl in roundup-server
Richard Jones <richard@users.sourceforge.net>
parents:
32
diff
changeset
|
324 # actually quit if python version wrong |
|
33bfce110d1e
Fixed the ROUNDUPS decl in roundup-server
Richard Jones <richard@users.sourceforge.net>
parents:
32
diff
changeset
|
325 # |
|
32
b475e7d3ce52
actually quit if python version wrong
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
27
diff
changeset
|
326 # Revision 1.1 2001/07/23 03:46:48 richard |
|
b475e7d3ce52
actually quit if python version wrong
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
27
diff
changeset
|
327 # moving the bin files to facilitate out-of-the-boxness |
|
b475e7d3ce52
actually quit if python version wrong
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
27
diff
changeset
|
328 # |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
329 # Revision 1.1 2001/07/22 11:15:45 richard |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
330 # More Grande Splite stuff |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
331 # |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
332 # |
|
127
0791d13baea7
Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents:
61
diff
changeset
|
333 # vim: set filetype=python ts=4 sw=4 et si |
