summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e6c4c7f)
raw | patch | inline | side by side (parent: e6c4c7f)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 1 Nov 2001 22:04:37 +0000 (22:04 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 1 Nov 2001 22:04:37 +0000 (22:04 +0000) |
Fixed bugs:
. bug #477104 ] HTML tag error in roundup-server
. bug #477107 ] HTTP header problem
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@354 57a73879-2fb5-44c3-a270-3262357dd7e2
. bug #477104 ] HTML tag error in roundup-server
. bug #477107 ] HTTP header problem
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@354 57a73879-2fb5-44c3-a270-3262357dd7e2
diff --git a/CHANGES.txt b/CHANGES.txt
index 80dad61af6e139216e81eace90ceed423c99736e..0943d9592a24e42baaaa899815c29afcc2859b52 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
. Fixed some URL issues in roundup.cgi, again thanks Juergen Hermann.
. bug #475347 ] WindowsError still not caught (patch from Juergen Hermann)
. bug #474749 ] indentations lost
+ . bug #477104 ] HTML tag error in roundup-server
+ . bug #477107 ] HTTP header problem
+
2001-10-23 - 0.3.0 pre 3
Feature:
diff --git a/cgi-bin/roundup.cgi b/cgi-bin/roundup.cgi
index c8b1030b823c464a0730f3de8099c52c3d4ebf87..ad92274b4a170903e0d88b95d689e7f65d296748 100755 (executable)
--- a/cgi-bin/roundup.cgi
+++ b/cgi-bin/roundup.cgi
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: roundup.cgi,v 1.15 2001-10-29 23:55:44 richard Exp $
+# $Id: roundup.cgi,v 1.16 2001-11-01 22:04:37 richard Exp $
# python version check
import sys
traceback.print_exc(None, s)
print cgi.escape(s.getvalue()), "</pre>"
+class RequestWrapper:
+ '''Used to make the CGI server look like a BaseHTTPRequestHandler
+ '''
+ def __init__(self, wfile):
+ self.wfile = wfile
+ def send_response(self, code):
+ self.wfile.write('Status: %s\r\n'%code)
+ def send_header(self, keyword, value):
+ self.wfile.write("%s: %s\r\n" % (keyword, value))
+ def end_headers(self, keyword, value):
+ self.wfile.write("\r\n")
+
def main(out, err):
import os, string
import roundup.instance
instance = path[1]
os.environ['INSTANCE_NAME'] = instance
os.environ['PATH_INFO'] = string.join(path[2:], '/')
+ request = RequestWrapper(out)
if ROUNDUP_INSTANCE_HOMES.has_key(instance):
instance_home = ROUNDUP_INSTANCE_HOMES[instance]
instance = roundup.instance.open(instance_home)
from roundup import cgi_client
- client = instance.Client(instance, out, os.environ)
+ client = instance.Client(instance, request, os.environ)
try:
client.main()
except cgi_client.Unauthorised:
- out.write('Content-Type: text/html\n')
- out.write('Status: 403\n\n')
+ request.send_response(403)
+ request.send_header('Content-Type', 'text/html')
+ request.end_headers()
out.write('Unauthorised')
except cgi_client.NotFound:
- out.write('Content-Type: text/html\n')
- out.write('Status: 404\n\n')
+ request.send_response(404)
+ request.send_header('Content-Type', 'text/html')
+ request.end_headers()
out.write('Not found: %s'%client.path)
else:
import urllib
- w = out.write
- w("Content-Type: text/html\n\n")
- w('<html><head><title>Roundup instances index</title><head>\n')
+ request.send_response(200)
+ request.send_header('Content-Type', 'text/html')
+ w = request.wfile.write
+ w('<html><head><title>Roundup instances index</title></head>\n')
w('<body><h1>Roundup instances index</h1><ol>\n')
for instance in ROUNDUP_INSTANCE_HOMES.keys():
w('<li><a href="%s/%s/index">%s</a>\n'%(
#
# $Log: not supported by cvs2svn $
+# Revision 1.15 2001/10/29 23:55:44 richard
+# Fix to CGI top-level index (thanks Juergen Hermann)
+#
# Revision 1.14 2001/10/27 00:22:35 richard
# Fixed some URL issues in roundup.cgi, again thanks Juergen Hermann.
#
diff --git a/roundup-mailgw b/roundup-mailgw
index 5ab60a6451f8aeedb3bcc087820e66e9914f344c..8e5e7754e8cefee578edcc24c0d45a63a6c46934 100755 (executable)
--- a/roundup-mailgw
+++ b/roundup-mailgw
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: roundup-mailgw,v 1.7 2001-08-07 00:24:42 richard Exp $
+# $Id: roundup-mailgw,v 1.8 2001-11-01 22:04:37 richard Exp $
import sys
if int(sys.version[0]) < 2:
import roundup.instance
instance = roundup.instance.open(instance_home)
-# invokde the mail handler
+# invoke the mail handler
db = instance.open('admin')
handler = instance.MailGW(db)
handler.main(sys.stdin)
#
# $Log: not supported by cvs2svn $
+# Revision 1.7 2001/08/07 00:24:42 richard
+# stupid typo
+#
# Revision 1.6 2001/08/07 00:15:51 richard
# Added the copyright/license notice to (nearly) all files at request of
# Bizar Software.
diff --git a/roundup-server b/roundup-server
index c8b83cdc6ff166ce72a8ee6279937758b7082789..de71d67928a39c78bb1c6da98daa7c0c137f8e40 100755 (executable)
--- a/roundup-server
+++ b/roundup-server
Based on CGIHTTPServer in the Python library.
-$Id: roundup-server,v 1.17 2001-10-29 23:55:44 richard Exp $
+$Id: roundup-server,v 1.18 2001-11-01 22:04:37 richard Exp $
"""
import sys
import os, urllib, StringIO, traceback, cgi, binascii, string, getopt, imp
import BaseHTTPServer
-import SimpleHTTPServer
# Roundup modules of use here
from roundup import cgitb, cgi_client
#
-class RoundupRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
+class RoundupRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
ROUNDUP_INSTANCE_HOMES = ROUNDUP_INSTANCE_HOMES
ROUNDUP_USER = ROUNDUP_USER
- def send_head(self):
- """Version of send_head that support CGI scripts"""
- # TODO: actually do the HEAD ...
- return self.run_cgi()
def run_cgi(self):
""" Execute the CGI command. Wrap an innner call in an error
self.wfile.write("</pre>\n")
sys.stdin = save_stdin
+ do_GET = do_POST = do_HEAD = send_head = run_cgi
+
def index(self):
''' Print up an index of the available instances
'''
w = self.wfile.write
w("Content-Type: text/html\n\n")
- w('<html><head><title>Roundup instances index</title><head>\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():
w('<li><a href="%s/index">%s</a>\n'%(urllib.quote(instance),
self.send_response(200, "Script output follows")
# do the roundup thang
- client = instance.Client(instance, self.wfile, env)
+ client = instance.Client(instance, self, env)
client.main()
- do_POST = run_cgi
-
def usage(message=''):
if message: message = 'Error: %s\n'%message
print '''%sUsage:
#
# $Log: not supported by cvs2svn $
+# Revision 1.17 2001/10/29 23:55:44 richard
+# Fix to CGI top-level index (thanks Juergen Hermann)
+#
# Revision 1.16 2001/10/27 00:12:21 richard
# Fixed roundup-server for windows, thanks Juergen Hermann.
#
diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py
index dbb7fc7c395914ecc09af611838c60e4a260ae47..c04321ef0fd6e889ac925b2c66b9795d260bc468 100644 (file)
--- a/roundup/cgi_client.py
+++ b/roundup/cgi_client.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: cgi_client.py,v 1.44 2001-10-28 23:03:08 richard Exp $
+# $Id: cgi_client.py,v 1.45 2001-11-01 22:04:37 richard Exp $
import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes
import base64, Cookie, time
ANONYMOUS_ACCESS = 'deny' # one of 'deny', 'allow'
ANONYMOUS_REGISTER = 'deny' # one of 'deny', 'allow'
- def __init__(self, instance, out, env):
+ def __init__(self, instance, request, env):
self.instance = instance
- self.out = out
+ self.request = request
self.env = env
self.path = env['PATH_INFO']
self.split_path = self.path.split('/')
- self.headers_done = 0
self.form = cgi.FieldStorage(environ=env)
self.headers_done = 0
self.debug = 0
return self.db.user.lookup(self.user)
def header(self, headers={'Content-Type':'text/html'}):
+ '''Put up the appropriate header.
+ '''
if not headers.has_key('Content-Type'):
headers['Content-Type'] = 'text/html'
+ self.request.send_response(200)
for entry in headers.items():
- self.out.write('%s: %s\n'%entry)
- self.out.write('\n')
+ self.request.send_header(*entry)
+ self.request.end_headers()
self.headers_done = 1
def pagehead(self, title, message=None):
def write(self, content):
if not self.headers_done:
self.header()
- self.out.write(content)
+ self.request.wfile.write(content)
def index_arg(self, arg):
''' handle the args to index - they might be a list from the form
#
# $Log: not supported by cvs2svn $
+# Revision 1.44 2001/10/28 23:03:08 richard
+# Added more useful header to the classic schema.
+#
# Revision 1.43 2001/10/24 00:01:42 richard
# More fixes to lockout logic.
#
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index 72b636f0f4d6067720bbaa79a7cca8bd5b59f7b5..b430f05debeb58c323eed67a7167b2a1b80532d2 100644 (file)
--- a/roundup/mailgw.py
+++ b/roundup/mailgw.py
an exception, the original message is bounced back to the sender with the
explanatory message given in the exception.
-$Id: mailgw.py,v 1.27 2001-10-30 11:26:10 richard Exp $
+$Id: mailgw.py,v 1.28 2001-11-01 22:04:37 richard Exp $
'''
def main(self, fp):
''' fp - the file from which to read the Message.
+ '''
+ self.handle_Message(Message(fp))
+
+ def handle_Message(self, message):
+ '''Handle an RFC822 Message
- Read a message from fp and then call handle_message() with the
- result. This method's job is to make that call and handle any
+ Hanle the Message object by calling handle_message() and then cope
+ with any errors raised by handle_message.
+ This method's job is to make that call and handle any
errors in a sane manner. It should be replaced if you wish to
handle errors in a different manner.
'''
- # ok, figure the subject, author, recipients and content-type
- message = Message(fp)
m = []
try:
self.handle_message(message)
#
# $Log: not supported by cvs2svn $
+# Revision 1.27 2001/10/30 11:26:10 richard
+# Case-insensitive match for ISSUE_TRACKER_EMAIL in address in e-mail.
+#
# Revision 1.26 2001/10/30 00:54:45 richard
# Features:
# . #467129 ] Lossage when username=e-mail-address