From b159e36fe7f411b734eaad1836294bdb68146025 Mon Sep 17 00:00:00 2001 From: richard Date: Sat, 29 Sep 2001 13:27:00 +0000 Subject: [PATCH] CGI interfaces now spit up a top-level index of all the instances they can serve. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@260 57a73879-2fb5-44c3-a270-3262357dd7e2 --- cgi-bin/roundup.cgi | 21 ++++++++++++++++++--- roundup-server | 21 ++++++++++++++++++--- roundup/backends/back_anydbm.py | 21 +++++++++++++-------- roundup/cgitb.py | 21 +++++---------------- 4 files changed, 54 insertions(+), 30 deletions(-) diff --git a/cgi-bin/roundup.cgi b/cgi-bin/roundup.cgi index 7e7f3e1..5dbf3d5 100755 --- a/cgi-bin/roundup.cgi +++ b/cgi-bin/roundup.cgi @@ -16,7 +16,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundup.cgi,v 1.10 2001-08-07 00:24:42 richard Exp $ +# $Id: roundup.cgi,v 1.11 2001-09-29 13:27:00 richard Exp $ # python version check import sys @@ -97,6 +97,18 @@ def main(instance, out): out.write('Status: 403\n\n') out.write('Unauthorised') +def index(out): + ''' Print up an index of the available instances + ''' + w = out.write + w("Content-Type: text/html\n\n") + w('Roundup instances index\n') + w('

Roundup instances index

    \n') + for instance in ROUNDUP_INSTANCE_HOMES.keys(): + w('
  1. %s\n'%(urllib.quote(instance), + instance)) + w('
') + # # Now do the actual CGI handling # @@ -111,9 +123,9 @@ try: if ROUNDUP_INSTANCE_HOMES.has_key(instance): instance_home = ROUNDUP_INSTANCE_HOMES[instance] instance = roundup.instance.open(instance_home) + main(instance, out) else: - raise ValueError, 'No such instance "%s"'%instance - main(instance, out) + index() except: sys.stdout, sys.stderr = out, err out.write('Content-Type: text/html\n\n') @@ -123,6 +135,9 @@ sys.stdout, sys.stderr = out, err # # $Log: not supported by cvs2svn $ +# Revision 1.10 2001/08/07 00:24:42 richard +# stupid typo +# # Revision 1.9 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 88afa89..fb905d1 100755 --- a/roundup-server +++ b/roundup-server @@ -20,7 +20,7 @@ Based on CGIHTTPServer in the Python library. -$Id: roundup-server,v 1.11 2001-08-07 00:24:42 richard Exp $ +$Id: roundup-server,v 1.12 2001-09-29 13:27:00 richard Exp $ """ import sys @@ -94,6 +94,18 @@ class RoundupRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): self.wfile.write("\n") sys.stdin = save_stdin + def index(self): + ''' Print up an index of the available instances + ''' + w = self.wfile.write + w("Content-Type: text/html\n\n") + w('Roundup instances index\n') + w('

Roundup instances index

    \n') + for instance in self.ROUNDUP_INSTANCE_HOMES.keys(): + w('
  1. %s\n'%(urllib.quote(instance), + instance)) + w('
') + def inner_run_cgi(self): ''' This is the inner part of the CGI handling ''' @@ -107,14 +119,14 @@ class RoundupRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): # figure the instance if rest == '/': - raise ValueError, 'No instance specified' + return self.index() l_path = string.split(rest, '/') instance = urllib.unquote(l_path[1]) if self.ROUNDUP_INSTANCE_HOMES.has_key(instance): instance_home = self.ROUNDUP_INSTANCE_HOMES[instance] instance = roundup.instance.open(instance_home) else: - raise ValueError, 'No such instance "%s"'%instance + return self.index() # figure out what the rest of the path is if len(l_path) > 2: @@ -270,6 +282,9 @@ if __name__ == '__main__': # # $Log: not supported by cvs2svn $ +# Revision 1.11 2001/08/07 00:24:42 richard +# stupid typo +# # Revision 1.10 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/backends/back_anydbm.py b/roundup/backends/back_anydbm.py index 36fb3df..9f31240 100644 --- a/roundup/backends/back_anydbm.py +++ b/roundup/backends/back_anydbm.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -#$Id: back_anydbm.py,v 1.7 2001-08-12 06:32:36 richard Exp $ +#$Id: back_anydbm.py,v 1.8 2001-09-29 13:27:00 richard Exp $ import anydbm, os, marshal from roundup import hyperdb, date @@ -41,6 +41,7 @@ class Database(hyperdb.Database): """ self.dir, self.journaltag = storagelocator, journaltag self.classes = {} + self.transactions = [] # # Classes @@ -203,21 +204,25 @@ class Database(hyperdb.Database): # # Basic transaction support # - # TODO: well, write these methods (and then use them in other code) - def register_action(self): - ''' Register an action to the transaction undo log - ''' - def commit(self): - ''' Commit the current transaction, start a new one + ''' Commit the current transactions. ''' + # lock the DB + for action, classname, entry in self.transactions: + # write the node, figure what's changed for the journal. + pass + # unlock the DB def rollback(self): - ''' Reverse all actions from the current transaction + ''' Reverse all actions from the current transaction. ''' + self.transactions = [] # #$Log: not supported by cvs2svn $ +#Revision 1.7 2001/08/12 06:32:36 richard +#using isinstance(blah, Foo) now instead of isFooType +# #Revision 1.6 2001/08/07 00:24:42 richard #stupid typo # diff --git a/roundup/cgitb.py b/roundup/cgitb.py index 8519a97..9c9d0ed 100644 --- a/roundup/cgitb.py +++ b/roundup/cgitb.py @@ -1,21 +1,7 @@ # -# Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/) -# This module is free software, and you may redistribute it and/or modify -# under the same terms as Python, so long as this copyright message and -# disclaimer are retained in their original form. -# -# IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR -# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING -# OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -# BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, -# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" -# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, -# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# This module was written by Ka-Ping Yee, . # -# $Id: cgitb.py,v 1.5 2001-08-07 00:24:42 richard Exp $ +# $Id: cgitb.py,v 1.6 2001-09-29 13:27:00 richard Exp $ import sys, os, types, string, keyword, linecache, tokenize, inspect, pydoc @@ -132,6 +118,9 @@ def handler(): # # $Log: not supported by cvs2svn $ +# Revision 1.5 2001/08/07 00:24:42 richard +# stupid typo +# # Revision 1.4 2001/08/07 00:15:51 richard # Added the copyright/license notice to (nearly) all files at request of # Bizar Software. -- 2.30.2