diff roundup-server @ 431:a28a80b714f9

Eliminate database close method by using weakrefs. . We now use weakrefs in the Classes to keep the database reference, so the close() method on the database is no longer needed. I bumped the minimum python requirement up to 2.1 accordingly. . [SF#487480] roundup-server . [SF#487476] INSTALL.txt I also cleaned up the change message / post-edit stuff in the cgi client. There's now a clearly marked "TODO: append the change note" where I believe the change note should be added there. The "changes" list will obviously have to be modified to be a dict of the changes, or somesuch. More testing needed.
author Richard Jones <richard@users.sourceforge.net>
date Sun, 02 Dec 2001 05:06:16 +0000
parents a6088556e9ba
children 141aacfdb34f
line wrap: on
line diff
--- a/roundup-server	Sat Dec 01 07:17:50 2001 +0000
+++ b/roundup-server	Sun Dec 02 05:06:16 2001 +0000
@@ -20,13 +20,12 @@
 
 Based on CGIHTTPServer in the Python library.
 
-$Id: roundup-server,v 1.20 2001-11-26 22:55:56 richard Exp $
+$Id: roundup-server,v 1.21 2001-12-02 05:06:16 richard Exp $
 
 """
 import sys
-if int(sys.version[0]) < 2:
-    print "Content-Type: text/plain\n"
-    print "Roundup requires Python 2.0 or newer."
+if not hasattr(sys, 'version_info') or sys.version_info[:2] < (2,1):
+    print "Roundup requires Python 2.1 or newer."
     sys.exit(0)
 
 import os, urllib, StringIO, traceback, cgi, binascii, string, getopt, imp
@@ -77,17 +76,18 @@
         except cgi_client.NotFound:
             self.send_error(404, self.path)
         except cgi_client.Unauthorised:
-            self.wfile.write('Content-Type: text/html\n')
-            self.wfile.write('Status: 403\n\n')
-            self.wfile.write('You are not authorised to access this URL.')
+            self.send_error(403, self.path)
         except:
+            # it'd be nice to be able to detect if these are going to have
+            # any effect...
+            self.send_response(400)
+            self.send_header('Content-Type', 'text/html')
+            self.end_headers()
             try:
                 reload(cgitb)
-                self.wfile.write("Content-Type: text/html\n\n")
                 self.wfile.write(cgitb.breaker())
                 self.wfile.write(cgitb.html())
             except:
-                self.wfile.write("Content-Type: text/html\n\n")
                 self.wfile.write("<pre>")
                 s = StringIO.StringIO()
                 traceback.print_exc(None, s)
@@ -100,8 +100,10 @@
     def index(self):
         ''' Print up an index of the available instances
         '''
+        self.send_response(200)
+        self.send_header('Content-Type', 'text/html')
+        self.end_headers()
         w = self.wfile.write
-        w("Content-Type: text/html\n\n")
         w('<html><head><title>Roundup instances index</title></head>\n')
         w('<body><h1>Roundup instances index</h1><ol>\n')
         for instance in self.ROUNDUP_INSTANCE_HOMES.keys():
@@ -161,21 +163,6 @@
 
         decoded_query = query.replace('+', ' ')
 
-        # reload all modules
-        # TODO check for file timestamp changes and dependencies
-        #reload(date)
-        #reload(hyperdb)
-        #reload(roundupdb)
-        #reload(htmltemplate)
-        #reload(cgi_client)
-        #sys.path.insert(0, module_path)
-        #try:
-        #    reload(instance)
-        #finally:
-        #    del sys.path[0]
-
-        self.send_response(200, "Script output follows")
-
         # do the roundup thang
         client = instance.Client(instance, self, env)
         client.main()
@@ -262,6 +249,18 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.20  2001/11/26 22:55:56  richard
+# Feature:
+#  . Added INSTANCE_NAME to configuration - used in web and email to identify
+#    the instance.
+#  . Added EMAIL_SIGNATURE_POSITION to indicate where to place the roundup
+#    signature info in e-mails.
+#  . Some more flexibility in the mail gateway and more error handling.
+#  . Login now takes you to the page you back to the were denied access to.
+#
+# Fixed:
+#  . Lots of bugs, thanks Roché and others on the devel mailing list!
+#
 # Revision 1.19  2001/11/12 22:51:04  jhermann
 # Fixed option & associated error handling
 #

Roundup Issue Tracker: http://roundup-tracker.org/