comparison roundup-admin @ 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 350685601f37
children 9d97c1a4ddad
comparison
equal deleted inserted replaced
430:350685601f37 431:a28a80b714f9
14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
18 # 18 #
19 # $Id: roundup-admin,v 1.49 2001-12-01 07:17:50 richard Exp $ 19 # $Id: roundup-admin,v 1.50 2001-12-02 05:06:16 richard Exp $
20 20
21 import sys 21 import sys
22 if int(sys.version[0]) < 2: 22 if not hasattr(sys, 'version_info') or sys.version_info[:2] < (2,1):
23 print 'Roundup requires python 2.0 or later.' 23 print 'Roundup requires python 2.1 or later.'
24 sys.exit(1) 24 sys.exit(1)
25 25
26 import string, os, getpass, getopt, re, UserDict 26 import string, os, getpass, getopt, re, UserDict
27 try: 27 try:
28 import csv 28 import csv
612 raise UsageError, 'no such class "%s"'%classname 612 raise UsageError, 'no such class "%s"'%classname
613 except IndexError: 613 except IndexError:
614 raise UsageError, 'no such %s node "%s"'%(classname, nodeid) 614 raise UsageError, 'no such %s node "%s"'%(classname, nodeid)
615 return 0 615 return 0
616 616
617 def do_commit(self, args):
618 '''Usage: commit
619 Commit all changes made to the database.
620
621 The changes made during an interactive session are not
622 automatically written to the database - they must be committed
623 using this command.
624
625 One-off commands on the command-line are automatically committed if
626 they are successful.
627 '''
628 self.db.commit()
629 return 0
630
631 def do_rollback(self, args):
632 '''Usage: rollback
633 Undo all changes that are pending commit to the database.
634
635 The changes made during an interactive session are not
636 automatically written to the database - they must be committed
637 manually. This command undoes all those changes, so a commit
638 immediately after would make no changes to the database.
639 '''
640 self.db.commit()
641 return 0
642
617 def do_retire(self, args): 643 def do_retire(self, args):
618 '''Usage: retire designator[,designator]* 644 '''Usage: retire designator[,designator]*
619 Retire the node specified by designator. 645 Retire the node specified by designator.
620 646
621 This action indicates that a particular node is not to be retrieved by 647 This action indicates that a particular node is not to be retrieved by
881 if not args: 907 if not args:
882 self.interactive() 908 self.interactive()
883 else: 909 else:
884 ret = self.run_command(args) 910 ret = self.run_command(args)
885 if self.db: self.db.commit() 911 if self.db: self.db.commit()
886 if self.db: self.db.close()
887 return ret 912 return ret
888 913
889 914
890 if __name__ == '__main__': 915 if __name__ == '__main__':
891 tool = AdminTool() 916 tool = AdminTool()
892 sys.exit(tool.main()) 917 sys.exit(tool.main())
893 918
894 # 919 #
895 # $Log: not supported by cvs2svn $ 920 # $Log: not supported by cvs2svn $
921 # Revision 1.49 2001/12/01 07:17:50 richard
922 # . We now have basic transaction support! Information is only written to
923 # the database when the commit() method is called. Only the anydbm
924 # backend is modified in this way - neither of the bsddb backends have been.
925 # The mail, admin and cgi interfaces all use commit (except the admin tool
926 # doesn't have a commit command, so interactive users can't commit...)
927 # . Fixed login/registration forwarding the user to the right page (or not,
928 # on a failure)
929 #
896 # Revision 1.48 2001/11/27 22:32:03 richard 930 # Revision 1.48 2001/11/27 22:32:03 richard
897 # typo 931 # typo
898 # 932 #
899 # Revision 1.47 2001/11/26 22:55:56 richard 933 # Revision 1.47 2001/11/26 22:55:56 richard
900 # Feature: 934 # Feature:

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