Mercurial > p > roundup > code
annotate roundup-server @ 190:996eaf90c01e
Instance import now imports the instance using imp.load_module...
...so that we can have instance homes of "roundup" or other existing
python package names.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 03 Aug 2001 00:59:34 +0000 |
| parents | 0791d13baea7 |
| children | 241a0323aacb |
| 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 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2 """ 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
|
3 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4 Stolen from CGIHTTPServer |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
5 |
|
190
996eaf90c01e
Instance import now imports the instance using imp.load_module...
Richard Jones <richard@users.sourceforge.net>
parents:
127
diff
changeset
|
6 $Id: roundup-server,v 1.7 2001-08-03 00:59:34 richard Exp $ |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
7 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
8 """ |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
9 import sys |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
10 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
|
11 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
|
12 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
|
13 sys.exit(0) |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
14 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
15 __version__ = "0.1" |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
16 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
17 __all__ = ["RoundupRequestHandler"] |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
18 |
|
190
996eaf90c01e
Instance import now imports the instance using imp.load_module...
Richard Jones <richard@users.sourceforge.net>
parents:
127
diff
changeset
|
19 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
|
20 import BaseHTTPServer |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
21 import SimpleHTTPServer |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
22 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
23 # 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
|
24 from roundup import cgitb, cgi_client |
|
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 # |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
27 ## Configuration |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
28 # |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
29 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
30 # 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
|
31 ROUNDUP_INSTANCE_HOMES = { |
|
54
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
32 'bar': '/tmp/bar', |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
33 } |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
34 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
35 # 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
|
36 # 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
|
37 # 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
|
38 #class DevNull: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
39 # def write(self, info): |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
40 # pass |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
41 #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
|
42 #LOG = DevNull() |
|
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 # |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
45 ## end configuration |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
46 # |
|
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 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
49 class RoundupRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): |
|
61
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
50 ROUNDUP_INSTANCE_HOMES = ROUNDUP_INSTANCE_HOMES |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
51 def send_head(self): |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
52 """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
|
53 # 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
|
54 return self.run_cgi() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
55 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
56 def run_cgi(self): |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
57 """ 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
|
58 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
|
59 """ |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
60 save_stdin = sys.stdin |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
61 sys.stdin = self.rfile |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
62 try: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
63 self.inner_run_cgi() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
64 except cgi_client.Unauthorised: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
65 self.wfile.write('Content-Type: text/html\n') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
66 self.wfile.write('Status: 403\n') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
67 self.wfile.write('Unauthorised') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
68 except: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
69 try: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
70 reload(cgitb) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
71 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
|
72 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
|
73 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
|
74 except: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
75 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
|
76 self.wfile.write("<pre>") |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
77 s = StringIO.StringIO() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
78 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
|
79 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
|
80 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
|
81 sys.stdin = save_stdin |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
82 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
83 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
|
84 ''' 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
|
85 ''' |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
86 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
87 rest = self.path |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
88 i = rest.rfind('?') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
89 if i >= 0: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
90 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
|
91 else: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
92 query = '' |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
93 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
94 # figure the instance |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
95 if rest == '/': |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
96 raise ValueError, 'No instance specified' |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
97 l_path = string.split(rest, '/') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
98 instance = urllib.unquote(l_path[1]) |
|
61
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
99 if self.ROUNDUP_INSTANCE_HOMES.has_key(instance): |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
100 instance_home = self.ROUNDUP_INSTANCE_HOMES[instance] |
|
190
996eaf90c01e
Instance import now imports the instance using imp.load_module...
Richard Jones <richard@users.sourceforge.net>
parents:
127
diff
changeset
|
101 instance = imp.load_module('instance', None, instance_home, |
|
996eaf90c01e
Instance import now imports the instance using imp.load_module...
Richard Jones <richard@users.sourceforge.net>
parents:
127
diff
changeset
|
102 ('', '', 5)) |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
103 else: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
104 raise ValueError, 'No such instance "%s"'%instance |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
105 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
106 # 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
|
107 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
|
108 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
|
109 else: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
110 rest = '/' |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
111 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
112 # 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
|
113 env = {} |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
114 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
|
115 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
|
116 if query: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
117 env['QUERY_STRING'] = query |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
118 host = self.address_string() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
119 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
|
120 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
|
121 else: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
122 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
|
123 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
|
124 if length: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
125 env['CONTENT_LENGTH'] = length |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
126 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
|
127 if co: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
128 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
|
129 env['SCRIPT_NAME'] = '' |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
130 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
|
131 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
|
132 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
133 decoded_query = query.replace('+', ' ') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
134 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
135 # if root, setuid to nobody |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
136 # TODO why isn't this done much earlier? - say, in main()? |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
137 if not os.getuid(): |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
138 nobody = nobody_uid() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
139 os.setuid(nobody) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
140 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
141 # reload all modules |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
142 # 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
|
143 #reload(date) |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
144 #reload(hyperdb) |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
145 #reload(roundupdb) |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
146 #reload(htmltemplate) |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
147 #reload(cgi_client) |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
148 #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
|
149 #try: |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
150 # reload(instance) |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
151 #finally: |
|
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
152 # 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
|
153 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
154 # initialise the roundupdb, check for auth |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
155 db = instance.open('admin') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
156 message = 'Unauthorised' |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
157 auth = self.headers.getheader('authorization') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
158 if auth: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
159 l = binascii.a2b_base64(auth.split(' ')[1]).split(':') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
160 user = l[0] |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
161 password = None |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
162 if len(l) > 1: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
163 password = l[1] |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
164 try: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
165 uid = db.user.lookup(user) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
166 except KeyError: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
167 auth = None |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
168 message = 'Username not recognised' |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
169 else: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
170 if password != db.user.get(uid, 'password'): |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
171 message = 'Incorrect password' |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
172 auth = None |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
173 db.close() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
174 del db |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
175 if not auth: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
176 self.send_response(401) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
177 self.send_header('Content-Type', 'text/html') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
178 self.send_header('WWW-Authenticate', 'basic realm="Roundup"') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
179 self.end_headers() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
180 self.wfile.write(message) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
181 return |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
182 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
183 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
|
184 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
185 # do the roundup thang |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
186 db = instance.open(user) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
187 client = instance.Client(self.wfile, db, env, user) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
188 client.main() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
189 do_POST = run_cgi |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
190 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
191 nobody = None |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
192 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
193 def nobody_uid(): |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
194 """Internal routine to get nobody's uid""" |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
195 global nobody |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
196 if nobody: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
197 return nobody |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
198 try: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
199 import pwd |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
200 except ImportError: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
201 return -1 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
202 try: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
203 nobody = pwd.getpwnam('nobody')[2] |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
204 except KeyError: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
205 nobody = 1 + max(map(lambda x: x[2], pwd.getpwall())) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
206 return nobody |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
207 |
|
61
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
208 def usage(message=''): |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
209 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
|
210 print '''%sUsage: |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
211 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
|
212 |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
213 -n: sets the host name |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
214 -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
|
215 |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
216 name=instance home |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
217 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
|
218 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
|
219 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
|
220 "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
|
221 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
|
222 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
|
223 '''%message |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
224 sys.exit(0) |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
225 |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
226 def main(): |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
227 hostname = '' |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
228 port = 8080 |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
229 try: |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
230 # handle the command-line args |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
231 optlist, args = getopt.getopt(sys.argv[1:], 'n:p:') |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
232 for (opt, arg) in optlist: |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
233 if opt == '-n': hostname = arg |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
234 elif opt == '-p': port = int(arg) |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
235 elif opt == '-h': usage() |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
236 |
|
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: |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
241 name, home = string.split(arg, '=') |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
242 d[name] = home |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
243 RoundupRequestHandler.ROUNDUP_INSTANCE_HOMES = d |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
244 except: |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
245 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
|
246 usage('%s: %s'%(type, value)) |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
247 |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
248 # 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
|
249 sys.argv = sys.argv[:1] |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
250 address = (hostname, port) |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
251 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
|
252 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
|
253 httpd.serve_forever() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
254 |
|
61
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
255 if __name__ == '__main__': |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
256 main() |
|
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
257 |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
258 # |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
259 # $Log: not supported by cvs2svn $ |
|
190
996eaf90c01e
Instance import now imports the instance using imp.load_module...
Richard Jones <richard@users.sourceforge.net>
parents:
127
diff
changeset
|
260 # 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
|
261 # 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
|
262 # |
|
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
|
263 # 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
|
264 # 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
|
265 # 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
|
266 # |
|
61
820c8bb1b71a
Added command-line arg handling to roundup-server...
Richard Jones <richard@users.sourceforge.net>
parents:
54
diff
changeset
|
267 # 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
|
268 # 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
|
269 # |
|
54
b68bcb176d1a
disabled the reloading until it can be done properly
Richard Jones <richard@users.sourceforge.net>
parents:
52
diff
changeset
|
270 # 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
|
271 # 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
|
272 # 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
|
273 # |
|
52
33bfce110d1e
Fixed the ROUNDUPS decl in roundup-server
Richard Jones <richard@users.sourceforge.net>
parents:
32
diff
changeset
|
274 # 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
|
275 # actually quit if python version wrong |
|
33bfce110d1e
Fixed the ROUNDUPS decl in roundup-server
Richard Jones <richard@users.sourceforge.net>
parents:
32
diff
changeset
|
276 # |
|
32
b475e7d3ce52
actually quit if python version wrong
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
27
diff
changeset
|
277 # 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
|
278 # 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
|
279 # |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
280 # 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
|
281 # More Grande Splite stuff |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
282 # |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
283 # |
|
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
|
284 # vim: set filetype=python ts=4 sw=4 et si |
