Skip to content

Commit 2a1573e

Browse files
author
Richard Jones
committed
Notes from changes.
>From CHANGES: . Added the "display" command to the admin tool - displays a node's values . [SF#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
1 parent 0e9d181 commit 2a1573e

File tree

6 files changed

+107
-19
lines changed

6 files changed

+107
-19
lines changed

CHANGES.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ Feature:
1313
. We now have basic transaction support. Information is only written to
1414
the database when the commit() method is called. Only the anydbm backend
1515
is modified in this way - neither of the bsddb backends have been.
16+
- the CGI and mailgw automatically commit() at the end of processing a
17+
single transaction
18+
- the admin tool requires an explicit "commit" - it will prompt at exit
19+
if there are unsaved changes. A "rollback" removes all changes made
20+
during the session (up to the last commit).
21+
. Added the "display" command to the admin tool - displays a node's values
1622

1723

1824
Fixed:
@@ -26,6 +32,8 @@ Fixed:
2632
the close() method on the database is no longer needed.
2733
. #487480 ] roundup-server
2834
. #487476 ] INSTALL.txt
35+
. #489760 ] [issue] only subject
36+
. fixed doc/index.html to include the quoting in the mail alias.
2937

3038

3139
2001-11-23 - 0.3.0

INSTALL.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Set up a mail alias called "issue_tracker" as:
8989
In some installations (e.g. RedHat 6.2 I think) you'll need to set up smrsh
9090
so sendmail will accept the pipe command. In that case, symlink
9191
/etc/smrsh/roundup-mailgw to /usr/local/bin/roundup-mailgw and change the
92-
command to:
92+
command to (include the quote marks):
9393
"|roundup-mailgw <instance_home>"
9494

9595
To test the mail gateway on unix systems, try:

doc/index.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,9 @@ <h2><a name="startcmd">Command Line Tool</a></h2>
160160
<h2><a name="startweb">E-Mail Interface</a></h2>
161161

162162
<h3>Setup 1: As a mail alias pipe process</h3>
163-
Set up a mail alias called "issue_tracker" as:
163+
Set up a mail alias called "issue_tracker" as (include the quote marks):
164164
<blockquote>
165-
<tt>|/usr/bin/python /usr/local/bin/roundup-mailgw
166-
&lt;instance_home&gt;</tt>
165+
<tt>"|/usr/bin/python /usr/local/bin/roundup-mailgw &lt;instance_home&gt;"</tt>
167166
</blockquote>
168167

169168
In some installations (e.g. RedHat 6.2 I think) you'll need to set up smrsh
@@ -1201,7 +1200,7 @@ <h1><a name="ack">Acknowledgements</a></h1>
12011200

12021201
<p>&nbsp;</p>
12031202
<hr>
1204-
$Id: index.html,v 1.19 2001-11-21 23:42:54 richard Exp $
1203+
$Id: index.html,v 1.20 2001-12-10 00:57:38 richard Exp $
12051204
<p>&nbsp;</p>
12061205

12071206
</body></html>

roundup-admin

Lines changed: 80 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
19-
# $Id: roundup-admin,v 1.50 2001-12-02 05:06:16 richard Exp $
19+
# $Id: roundup-admin,v 1.51 2001-12-10 00:57:38 richard Exp $
2020

2121
import sys
2222
if not hasattr(sys, 'version_info') or sys.version_info[:2] < (2,1):
@@ -64,6 +64,7 @@ class AdminTool:
6464
for k in AdminTool.__dict__.keys():
6565
if k[:5] == 'help_':
6666
self.help[k[5:]] = getattr(self, k)
67+
self.instance_home = ''
6768
self.db = None
6869

6970
def usage(self, message=''):
@@ -205,6 +206,8 @@ Command help:
205206
206207
See also initopts help.
207208
'''
209+
if len(args) < 1:
210+
raise UsageError, 'Not enough arguments supplied'
208211
# select template
209212
import roundup.templates
210213
templates = roundup.templates.listTemplates()
@@ -243,6 +246,8 @@ Command help:
243246
244247
Retrieves the property value of the nodes specified by the designators.
245248
'''
249+
if len(args) < 2:
250+
raise UsageError, 'Not enough arguments supplied'
246251
propname = args[0]
247252
designators = string.split(args[1], ',')
248253
l = []
@@ -279,6 +284,8 @@ Command help:
279284
280285
Sets the property to the value for all designators given.
281286
'''
287+
if len(args) < 2:
288+
raise UsageError, 'Not enough arguments supplied'
282289
from roundup import hyperdb
283290

284291
designators = string.split(args[0], ',')
@@ -340,6 +347,8 @@ Command help:
340347
Find the nodes of the given class with a given link property value. The
341348
value may be either the nodeid of the linked node, or its key value.
342349
'''
350+
if len(args) < 1:
351+
raise UsageError, 'Not enough arguments supplied'
343352
classname = args[0]
344353
# get the class
345354
try:
@@ -401,6 +410,8 @@ Command help:
401410
402411
This lists the properties for a given class.
403412
'''
413+
if len(args) < 1:
414+
raise UsageError, 'Not enough arguments supplied'
404415
classname = args[0]
405416
# get the class
406417
try:
@@ -416,6 +427,33 @@ Command help:
416427
else:
417428
print '%s: %s'%(key, value)
418429

430+
def do_display(self, args):
431+
'''Usage: display designator
432+
Show the property values for the given node.
433+
434+
This lists the properties and their associated values for the given
435+
node.
436+
'''
437+
if len(args) < 1:
438+
raise UsageError, 'Not enough arguments supplied'
439+
440+
# decode the node designator
441+
try:
442+
classname, nodeid = roundupdb.splitDesignator(args[0])
443+
except roundupdb.DesignatorError, message:
444+
raise UsageError, message
445+
446+
# get the class
447+
try:
448+
cl = self.db.getclass(classname)
449+
except KeyError:
450+
raise UsageError, 'invalid class "%s"'%classname
451+
452+
# display the values
453+
for key in cl.properties.keys():
454+
value = cl.get(nodeid, key)
455+
print '%s: %s'%(key, value)
456+
419457
def do_create(self, args):
420458
'''Usage: create classname property=value ...
421459
Create a new entry of a given class.
@@ -424,6 +462,8 @@ Command help:
424462
name=value arguments provided on the command line after the "create"
425463
command.
426464
'''
465+
if len(args) < 1:
466+
raise UsageError, 'Not enough arguments supplied'
427467
from roundup import hyperdb
428468

429469
classname = args[0]
@@ -508,6 +548,8 @@ Command help:
508548
in order: the key, "name", "title" and then the first property,
509549
alphabetically.
510550
'''
551+
if len(args) < 1:
552+
raise UsageError, 'Not enough arguments supplied'
511553
classname = args[0]
512554

513555
# get the class
@@ -548,6 +590,8 @@ Command help:
548590
3 usability
549591
4 feature
550592
'''
593+
if len(args) < 1:
594+
raise UsageError, 'Not enough arguments supplied'
551595
classname = args[0]
552596

553597
# get the class
@@ -600,6 +644,8 @@ Command help:
600644
601645
Lists the journal entries for the node identified by the designator.
602646
'''
647+
if len(args) < 1:
648+
raise UsageError, 'Not enough arguments supplied'
603649
try:
604650
classname, nodeid = roundupdb.splitDesignator(args[0])
605651
except roundupdb.DesignatorError, message:
@@ -637,7 +683,7 @@ Command help:
637683
manually. This command undoes all those changes, so a commit
638684
immediately after would make no changes to the database.
639685
'''
640-
self.db.commit()
686+
self.db.rollback()
641687
return 0
642688

643689
def do_retire(self, args):
@@ -647,6 +693,8 @@ Command help:
647693
This action indicates that a particular node is not to be retrieved by
648694
the list or find commands, and its key value may be re-used.
649695
'''
696+
if len(args) < 1:
697+
raise UsageError, 'Not enough arguments supplied'
650698
designators = string.split(args[0], ',')
651699
for designator in designators:
652700
try:
@@ -670,8 +718,7 @@ Command help:
670718
directory. The journals are not exported.
671719
'''
672720
if len(args) < 2:
673-
print do_export.__doc__
674-
return 1
721+
raise UsageError, 'Not enough arguments supplied'
675722
classes = string.split(args[0], ',')
676723
dir = args[1]
677724

@@ -834,13 +881,13 @@ Command help:
834881
try:
835882
instance = roundup.instance.open(self.instance_home)
836883
except ValueError, message:
884+
self.instance_home = ''
837885
print "Couldn't open instance: %s"%message
838886
return 1
839-
self.db = instance.open('admin')
840887

841-
if len(args) < 2:
842-
print function.__doc__
843-
return 1
888+
# only open the database once!
889+
if not self.db:
890+
self.db = instance.open('admin')
844891

845892
# do the command
846893
ret = 0
@@ -870,13 +917,21 @@ Command help:
870917
try:
871918
command = raw_input('roundup> ')
872919
except EOFError:
873-
print '.. exit'
874-
return 0
920+
print 'exit...'
921+
break
922+
if not command: continue
875923
args = ws_re.split(command)
876924
if not args: continue
877-
if args[0] in ('quit', 'exit'): return 0
925+
if args[0] in ('quit', 'exit'): break
878926
self.run_command(args)
879927

928+
# exit.. check for transactions
929+
if self.db and self.db.transactions:
930+
commit = raw_input("There are unsaved changes. Commit them (y/N)? ")
931+
if commit[0].lower() == 'y':
932+
self.db.commit()
933+
return 0
934+
880935
def main(self):
881936
try:
882937
opts, args = getopt.getopt(sys.argv[1:], 'i:u:hc')
@@ -918,6 +973,20 @@ if __name__ == '__main__':
918973

919974
#
920975
# $Log: not supported by cvs2svn $
976+
# Revision 1.50 2001/12/02 05:06:16 richard
977+
# . We now use weakrefs in the Classes to keep the database reference, so
978+
# the close() method on the database is no longer needed.
979+
# I bumped the minimum python requirement up to 2.1 accordingly.
980+
# . #487480 ] roundup-server
981+
# . #487476 ] INSTALL.txt
982+
#
983+
# I also cleaned up the change message / post-edit stuff in the cgi client.
984+
# There's now a clearly marked "TODO: append the change note" where I believe
985+
# the change note should be added there. The "changes" list will obviously
986+
# have to be modified to be a dict of the changes, or somesuch.
987+
#
988+
# More testing needed.
989+
#
921990
# Revision 1.49 2001/12/01 07:17:50 richard
922991
# . We now have basic transaction support! Information is only written to
923992
# the database when the commit() method is called. Only the anydbm

roundup/backends/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: __init__.py,v 1.6 2001-08-07 00:24:42 richard Exp $
18+
# $Id: __init__.py,v 1.7 2001-12-10 00:57:38 richard Exp $
1919

2020
__all__ = []
2121

2222
try:
23+
import anydbm, dumbdbm
24+
# dumbdbm in python 2,2b2, 2.1.1 and earlier is seriously broken
25+
assert anydbm._defaultmod != dumbdbm
26+
del anydbm
27+
del dumbdbm
2328
import back_anydbm
2429
anydbm = back_anydbm
2530
del back_anydbm
@@ -46,6 +51,9 @@
4651

4752
#
4853
# $Log: not supported by cvs2svn $
54+
# Revision 1.6 2001/08/07 00:24:42 richard
55+
# stupid typo
56+
#
4957
# Revision 1.5 2001/08/07 00:15:51 richard
5058
# Added the copyright/license notice to (nearly) all files at request of
5159
# Bizar Software.

roundup/mailgw.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class node. Any parts of other types are each stored in separate files
7373
an exception, the original message is bounced back to the sender with the
7474
explanatory message given in the exception.
7575
76-
$Id: mailgw.py,v 1.40 2001-12-05 14:26:44 rochecompaan Exp $
76+
$Id: mailgw.py,v 1.41 2001-12-10 00:57:38 richard Exp $
7777
'''
7878

7979

@@ -276,7 +276,7 @@ def handle_message(self, message):
276276
previous subject title intact so I can match that.
277277
278278
Subject was: "%s"
279-
'''%(classname, subject)
279+
'''%subject
280280

281281
# extract the args
282282
subject_args = m.group('args')
@@ -635,6 +635,10 @@ def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'),
635635

636636
#
637637
# $Log: not supported by cvs2svn $
638+
# Revision 1.40 2001/12/05 14:26:44 rochecompaan
639+
# Removed generation of change note from "sendmessage" in roundupdb.py.
640+
# The change note is now generated when the message is created.
641+
#
638642
# Revision 1.39 2001/12/02 05:06:16 richard
639643
# . We now use weakrefs in the Classes to keep the database reference, so
640644
# the close() method on the database is no longer needed.

0 commit comments

Comments
 (0)