From d8ec5b793387433502aaf703007e6caa9786d577 Mon Sep 17 00:00:00 2001 From: richard Date: Mon, 10 Dec 2001 00:57:38 +0000 Subject: [PATCH] From CHANGES: . Added the "display" command to the admin tool - displays a node's values . #489760 ] [issue] only subject . fixed the doc/index.html to include the quoting in the mail alias. Also: . fixed roundup-admin so it works with transactions . disabled the back_anydbm module if anydbm tries to use dumbdbm git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@450 57a73879-2fb5-44c3-a270-3262357dd7e2 --- CHANGES.txt | 8 ++++ INSTALL.txt | 2 +- doc/index.html | 7 ++- roundup-admin | 91 +++++++++++++++++++++++++++++++----- roundup/backends/__init__.py | 10 +++- roundup/mailgw.py | 8 +++- 6 files changed, 107 insertions(+), 19 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index bd0eb60..50ea6fa 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -13,6 +13,12 @@ Feature: . We now have basic transaction support. Information is only written to the database when the commit() method is called. Only the anydbm backend is modified in this way - neither of the bsddb backends have been. + - the CGI and mailgw automatically commit() at the end of processing a + single transaction + - the admin tool requires an explicit "commit" - it will prompt at exit + if there are unsaved changes. A "rollback" removes all changes made + during the session (up to the last commit). + . Added the "display" command to the admin tool - displays a node's values Fixed: @@ -26,6 +32,8 @@ Fixed: the close() method on the database is no longer needed. . #487480 ] roundup-server . #487476 ] INSTALL.txt + . #489760 ] [issue] only subject + . fixed doc/index.html to include the quoting in the mail alias. 2001-11-23 - 0.3.0 diff --git a/INSTALL.txt b/INSTALL.txt index 272f94e..2b4783c 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -89,7 +89,7 @@ Set up a mail alias called "issue_tracker" as: In some installations (e.g. RedHat 6.2 I think) you'll need to set up smrsh so sendmail will accept the pipe command. In that case, symlink /etc/smrsh/roundup-mailgw to /usr/local/bin/roundup-mailgw and change the -command to: +command to (include the quote marks): "|roundup-mailgw " To test the mail gateway on unix systems, try: diff --git a/doc/index.html b/doc/index.html index 1f0712e..342e02d 100644 --- a/doc/index.html +++ b/doc/index.html @@ -160,10 +160,9 @@ The email addresses used by the system by default are:

E-Mail Interface

Setup 1: As a mail alias pipe process

-Set up a mail alias called "issue_tracker" as: +Set up a mail alias called "issue_tracker" as (include the quote marks):
- |/usr/bin/python /usr/local/bin/roundup-mailgw - <instance_home> + "|/usr/bin/python /usr/local/bin/roundup-mailgw <instance_home>"
In some installations (e.g. RedHat 6.2 I think) you'll need to set up smrsh @@ -1201,7 +1200,7 @@ system on their time.

 


-$Id: index.html,v 1.19 2001-11-21 23:42:54 richard Exp $ +$Id: index.html,v 1.20 2001-12-10 00:57:38 richard Exp $

 

diff --git a/roundup-admin b/roundup-admin index 948c566..b9cdc9f 100755 --- a/roundup-admin +++ b/roundup-admin @@ -16,7 +16,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundup-admin,v 1.50 2001-12-02 05:06:16 richard Exp $ +# $Id: roundup-admin,v 1.51 2001-12-10 00:57:38 richard Exp $ import sys if not hasattr(sys, 'version_info') or sys.version_info[:2] < (2,1): @@ -64,6 +64,7 @@ class AdminTool: for k in AdminTool.__dict__.keys(): if k[:5] == 'help_': self.help[k[5:]] = getattr(self, k) + self.instance_home = '' self.db = None def usage(self, message=''): @@ -205,6 +206,8 @@ Command help: See also initopts help. ''' + if len(args) < 1: + raise UsageError, 'Not enough arguments supplied' # select template import roundup.templates templates = roundup.templates.listTemplates() @@ -243,6 +246,8 @@ Command help: Retrieves the property value of the nodes specified by the designators. ''' + if len(args) < 2: + raise UsageError, 'Not enough arguments supplied' propname = args[0] designators = string.split(args[1], ',') l = [] @@ -279,6 +284,8 @@ Command help: Sets the property to the value for all designators given. ''' + if len(args) < 2: + raise UsageError, 'Not enough arguments supplied' from roundup import hyperdb designators = string.split(args[0], ',') @@ -340,6 +347,8 @@ Command help: Find the nodes of the given class with a given link property value. The value may be either the nodeid of the linked node, or its key value. ''' + if len(args) < 1: + raise UsageError, 'Not enough arguments supplied' classname = args[0] # get the class try: @@ -401,6 +410,8 @@ Command help: This lists the properties for a given class. ''' + if len(args) < 1: + raise UsageError, 'Not enough arguments supplied' classname = args[0] # get the class try: @@ -416,6 +427,33 @@ Command help: else: print '%s: %s'%(key, value) + def do_display(self, args): + '''Usage: display designator + Show the property values for the given node. + + This lists the properties and their associated values for the given + node. + ''' + if len(args) < 1: + raise UsageError, 'Not enough arguments supplied' + + # decode the node designator + try: + classname, nodeid = roundupdb.splitDesignator(args[0]) + except roundupdb.DesignatorError, message: + raise UsageError, message + + # get the class + try: + cl = self.db.getclass(classname) + except KeyError: + raise UsageError, 'invalid class "%s"'%classname + + # display the values + for key in cl.properties.keys(): + value = cl.get(nodeid, key) + print '%s: %s'%(key, value) + def do_create(self, args): '''Usage: create classname property=value ... Create a new entry of a given class. @@ -424,6 +462,8 @@ Command help: name=value arguments provided on the command line after the "create" command. ''' + if len(args) < 1: + raise UsageError, 'Not enough arguments supplied' from roundup import hyperdb classname = args[0] @@ -508,6 +548,8 @@ Command help: in order: the key, "name", "title" and then the first property, alphabetically. ''' + if len(args) < 1: + raise UsageError, 'Not enough arguments supplied' classname = args[0] # get the class @@ -548,6 +590,8 @@ Command help: 3 usability 4 feature ''' + if len(args) < 1: + raise UsageError, 'Not enough arguments supplied' classname = args[0] # get the class @@ -600,6 +644,8 @@ Command help: Lists the journal entries for the node identified by the designator. ''' + if len(args) < 1: + raise UsageError, 'Not enough arguments supplied' try: classname, nodeid = roundupdb.splitDesignator(args[0]) except roundupdb.DesignatorError, message: @@ -637,7 +683,7 @@ Command help: manually. This command undoes all those changes, so a commit immediately after would make no changes to the database. ''' - self.db.commit() + self.db.rollback() return 0 def do_retire(self, args): @@ -647,6 +693,8 @@ Command help: This action indicates that a particular node is not to be retrieved by the list or find commands, and its key value may be re-used. ''' + if len(args) < 1: + raise UsageError, 'Not enough arguments supplied' designators = string.split(args[0], ',') for designator in designators: try: @@ -670,8 +718,7 @@ Command help: directory. The journals are not exported. ''' if len(args) < 2: - print do_export.__doc__ - return 1 + raise UsageError, 'Not enough arguments supplied' classes = string.split(args[0], ',') dir = args[1] @@ -834,13 +881,13 @@ Command help: try: instance = roundup.instance.open(self.instance_home) except ValueError, message: + self.instance_home = '' print "Couldn't open instance: %s"%message return 1 - self.db = instance.open('admin') - if len(args) < 2: - print function.__doc__ - return 1 + # only open the database once! + if not self.db: + self.db = instance.open('admin') # do the command ret = 0 @@ -870,13 +917,21 @@ Command help: try: command = raw_input('roundup> ') except EOFError: - print '.. exit' - return 0 + print 'exit...' + break + if not command: continue args = ws_re.split(command) if not args: continue - if args[0] in ('quit', 'exit'): return 0 + if args[0] in ('quit', 'exit'): break self.run_command(args) + # exit.. check for transactions + if self.db and self.db.transactions: + commit = raw_input("There are unsaved changes. Commit them (y/N)? ") + if commit[0].lower() == 'y': + self.db.commit() + return 0 + def main(self): try: opts, args = getopt.getopt(sys.argv[1:], 'i:u:hc') @@ -918,6 +973,20 @@ if __name__ == '__main__': # # $Log: not supported by cvs2svn $ +# Revision 1.50 2001/12/02 05:06:16 richard +# . 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. +# . #487480 ] roundup-server +# . #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. +# # Revision 1.49 2001/12/01 07:17:50 richard # . We now have basic transaction support! Information is only written to # the database when the commit() method is called. Only the anydbm diff --git a/roundup/backends/__init__.py b/roundup/backends/__init__.py index ca68569..cb01a56 100644 --- a/roundup/backends/__init__.py +++ b/roundup/backends/__init__.py @@ -15,11 +15,16 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: __init__.py,v 1.6 2001-08-07 00:24:42 richard Exp $ +# $Id: __init__.py,v 1.7 2001-12-10 00:57:38 richard Exp $ __all__ = [] try: + import anydbm, dumbdbm + # dumbdbm in python 2,2b2, 2.1.1 and earlier is seriously broken + assert anydbm._defaultmod != dumbdbm + del anydbm + del dumbdbm import back_anydbm anydbm = back_anydbm del back_anydbm @@ -46,6 +51,9 @@ except: # # $Log: not supported by cvs2svn $ +# Revision 1.6 2001/08/07 00:24:42 richard +# stupid typo +# # Revision 1.5 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/mailgw.py b/roundup/mailgw.py index 54de249..1f0a48a 100644 --- a/roundup/mailgw.py +++ b/roundup/mailgw.py @@ -73,7 +73,7 @@ are calling the create() method to create a new node). If an auditor raises an exception, the original message is bounced back to the sender with the explanatory message given in the exception. -$Id: mailgw.py,v 1.40 2001-12-05 14:26:44 rochecompaan Exp $ +$Id: mailgw.py,v 1.41 2001-12-10 00:57:38 richard Exp $ ''' @@ -276,7 +276,7 @@ supply a full node identifier (with number, eg "[issue123]" or keep the previous subject title intact so I can match that. Subject was: "%s" -'''%(classname, subject) +'''%subject # extract the args subject_args = m.group('args') @@ -635,6 +635,10 @@ def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'), # # $Log: not supported by cvs2svn $ +# Revision 1.40 2001/12/05 14:26:44 rochecompaan +# Removed generation of change note from "sendmessage" in roundupdb.py. +# The change note is now generated when the message is created. +# # Revision 1.39 2001/12/02 05:06:16 richard # . We now use weakrefs in the Classes to keep the database reference, so # the close() method on the database is no longer needed. -- 2.30.2