Mercurial > p > roundup > code
annotate roundup-admin @ 293:956a9a86217b
CGI interface wasn't handling checkboxes at all.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 16 Oct 2001 03:36:21 +0000 |
| parents | ee7705d7bb06 |
| children | 49be38bb6e9a |
| rev | line source |
|---|---|
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1 #! /usr/bin/python |
|
213
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
2 # |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
3 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/) |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
4 # This module is free software, and you may redistribute it and/or modify |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
5 # under the same terms as Python, so long as this copyright message and |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
6 # disclaimer are retained in their original form. |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
7 # |
| 214 | 8 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR |
|
213
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
9 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
10 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
11 # POSSIBILITY OF SUCH DAMAGE. |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
12 # |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
13 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
18 # |
|
291
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
19 # $Id: roundup-admin,v 1.28 2001-10-13 00:07:39 richard Exp $ |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
20 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
21 import sys |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
22 if int(sys.version[0]) < 2: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
23 print 'Roundup requires python 2.0 or later.' |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
24 sys.exit(1) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
25 |
|
204
c1461733cbf9
Instances are now opened by a special function...
Richard Jones <richard@users.sourceforge.net>
parents:
193
diff
changeset
|
26 import string, os, getpass, getopt, re |
|
278
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
27 try: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
28 import csv |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
29 except ImportError: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
30 csv = None |
|
270
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
31 from roundup import date, roundupdb, init, password |
|
204
c1461733cbf9
Instances are now opened by a special function...
Richard Jones <richard@users.sourceforge.net>
parents:
193
diff
changeset
|
32 import roundup.instance |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
33 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
34 def usage(message=''): |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
35 if message: message = 'Problem: '+message+'\n' |
|
291
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
36 print '''%sUsage: roundup-admin [-i instance home] [-u login] [-c] <command> <arguments> |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
37 |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
38 Help: |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
39 roundup-admin -h |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
40 roundup-admin help -- this help |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
41 roundup-admin help <command> -- command-specific help |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
42 roundup-admin help all -- all available help |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
43 Options: |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
44 -i instance home -- specify the issue tracker "home directory" to administer |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
45 -u -- the user[:password] to use for commands |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
46 -c -- when outputting lists of data, just comma-separate them'''%message |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
47 help_commands() |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
48 |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
49 def help_commands(): |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
50 print 'Commands:', |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
51 commands = [''] |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
52 for command in figureCommands().values(): |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
53 h = command.__doc__.split('\n')[0] |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
54 commands.append(h[7:]) |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
55 commands.sort() |
|
291
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
56 print '\n '.join(commands) |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
57 |
|
291
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
58 def help_all(): |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
59 print ''' |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
60 All commands (except help) require an instance specifier. This is just the path |
|
248
96cdd8ef0581
Added some more help to roundup-admin
Richard Jones <richard@users.sourceforge.net>
parents:
235
diff
changeset
|
61 to the roundup instance you're working with. A roundup instance is where |
|
96cdd8ef0581
Added some more help to roundup-admin
Richard Jones <richard@users.sourceforge.net>
parents:
235
diff
changeset
|
62 roundup keeps the database and configuration file that defines an issue |
|
96cdd8ef0581
Added some more help to roundup-admin
Richard Jones <richard@users.sourceforge.net>
parents:
235
diff
changeset
|
63 tracker. It may be thought of as the issue tracker's "home directory". It may |
|
96cdd8ef0581
Added some more help to roundup-admin
Richard Jones <richard@users.sourceforge.net>
parents:
235
diff
changeset
|
64 be specified in the environment variable ROUNDUP_INSTANCE or on the command |
|
96cdd8ef0581
Added some more help to roundup-admin
Richard Jones <richard@users.sourceforge.net>
parents:
235
diff
changeset
|
65 line as "-i instance". |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
66 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
67 A designator is a classname and a nodeid concatenated, eg. bug1, user10, ... |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
68 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
69 Property values are represented as strings in command arguments and in the |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
70 printed results: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
71 . Strings are, well, strings. |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
72 . Date values are printed in the full date format in the local time zone, and |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
73 accepted in the full format or any of the partial formats explained below. |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
74 . Link values are printed as node designators. When given as an argument, |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
75 node designators and key strings are both accepted. |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
76 . Multilink values are printed as lists of node designators joined by commas. |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
77 When given as an argument, node designators and key strings are both |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
78 accepted; an empty string, a single node, or a list of nodes joined by |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
79 commas is accepted. |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
80 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
81 When multiple nodes are specified to the roundup get or roundup set |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
82 commands, the specified properties are retrieved or set on all the listed |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
83 nodes. |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
84 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
85 When multiple results are returned by the roundup get or roundup find |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
86 commands, they are printed one per line (default) or joined by commas (with |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
87 the -c) option. |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
88 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
89 Where the command changes data, a login name/password is required. The |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
90 login may be specified as either "name" or "name:password". |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
91 . ROUNDUP_LOGIN environment variable |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
92 . the -u command-line option |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
93 If either the name or password is not supplied, they are obtained from the |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
94 command-line. |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
95 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
96 Date format examples: |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
97 "2000-04-17.03:45" means <Date 2000-04-17.08:45:00> |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
98 "2000-04-17" means <Date 2000-04-17.00:00:00> |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
99 "01-25" means <Date yyyy-01-25.00:00:00> |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
100 "08-13.22:13" means <Date yyyy-08-14.03:13:00> |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
101 "11-07.09:32:43" means <Date yyyy-11-07.14:32:43> |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
102 "14:25" means <Date yyyy-mm-dd.19:25:00> |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
103 "8:47:11" means <Date yyyy-mm-dd.13:47:11> |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
104 "." means "right now" |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
105 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
106 Command help: |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
107 ''' |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
108 for name, command in figureCommands().items(): |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
109 print '%s:'%name |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
110 print ' ',command.__doc__ |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
111 |
|
291
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
112 def do_help(args): |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
113 '''Usage: help topic |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
114 Give help about topic. |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
115 |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
116 commands -- list commands |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
117 <command> -- help specific to a command |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
118 initopts -- init command options |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
119 all -- all available help |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
120 ''' |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
121 help = figureHelp().get(args[0], None) |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
122 if help: |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
123 help() |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
124 return |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
125 help = figureCommands().get(args[0], None) |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
126 if help: |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
127 print help.__doc__ |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
128 |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
129 def help_initopts(): |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
130 import roundup.templates |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
131 templates = roundup.templates.listTemplates() |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
132 print 'Templates:', ', '.join(templates) |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
133 import roundup.backends |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
134 backends = roundup.backends.__all__ |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
135 print 'Back ends:', ', '.join(backends) |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
136 |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
137 |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
138 def do_init(instance_home, args, comma_sep=0): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
139 '''Usage: init [template [backend [admin password]]] |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
140 Initialise a new Roundup instance. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
141 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
142 The command will prompt for the instance home directory (if not supplied |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
143 through INSTANCE_HOME or the -i option. The template, backend and admin |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
144 password may be specified on the command-line as arguments, in that order. |
|
291
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
145 |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
146 See also initopts help. |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
147 ''' |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
148 # select template |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
149 import roundup.templates |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
150 templates = roundup.templates.listTemplates() |
| 147 | 151 template = len(args) > 1 and args[1] or '' |
| 152 if template not in templates: | |
| 153 print 'Templates:', ', '.join(templates) | |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
154 while template not in templates: |
|
264
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
262
diff
changeset
|
155 template = raw_input('Select template [extended]: ').strip() |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
156 if not template: |
|
264
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
262
diff
changeset
|
157 template = 'extended' |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
158 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
159 import roundup.backends |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
160 backends = roundup.backends.__all__ |
| 147 | 161 backend = len(args) > 2 and args[2] or '' |
| 162 if backend not in backends: | |
| 163 print 'Back ends:', ', '.join(backends) | |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
164 while backend not in backends: |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
165 backend = raw_input('Select backend [anydbm]: ').strip() |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
166 if not backend: |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
167 backend = 'anydbm' |
| 147 | 168 if len(args) > 3: |
| 169 adminpw = confirm = args[3] | |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
170 else: |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
171 adminpw = '' |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
172 confirm = 'x' |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
173 while adminpw != confirm: |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
174 adminpw = getpass.getpass('Admin Password: ') |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
175 confirm = getpass.getpass(' Confirm: ') |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
176 init.init(instance_home, template, backend, adminpw) |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
177 return 0 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
178 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
179 |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
180 def do_get(db, args, comma_sep=0): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
181 '''Usage: get property designator[,designator]* |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
182 Get the given property of one or more designator(s). |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
183 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
184 Retrieves the property value of the nodes specified by the designators. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
185 ''' |
|
261
0ca5381a72b5
made do_get have the args in the correct order
Richard Jones <richard@users.sourceforge.net>
parents:
248
diff
changeset
|
186 propname = args[0] |
|
0ca5381a72b5
made do_get have the args in the correct order
Richard Jones <richard@users.sourceforge.net>
parents:
248
diff
changeset
|
187 designators = string.split(args[1], ',') |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
188 l = [] |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
189 for designator in designators: |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
190 classname, nodeid = roundupdb.splitDesignator(designator) |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
191 if comma_sep: |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
192 l.append(db.getclass(classname).get(nodeid, propname)) |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
193 else: |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
194 print db.getclass(classname).get(nodeid, propname) |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
195 if comma_sep: |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
196 print ','.join(l) |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
197 return 0 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
198 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
199 |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
200 def do_set(db, args, comma_sep=0): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
201 '''Usage: set designator[,designator]* propname=value ... |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
202 Set the given property of one or more designator(s). |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
203 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
204 Sets the property to the value for all designators given. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
205 ''' |
|
235
d7d358408537
added missing 'import' statements.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
224
diff
changeset
|
206 from roundup import hyperdb |
|
d7d358408537
added missing 'import' statements.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
224
diff
changeset
|
207 |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
208 designators = string.split(args[0], ',') |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
209 props = {} |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
210 for prop in args[1:]: |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
211 key, value = prop.split('=') |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
212 props[key] = value |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
213 for designator in designators: |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
214 classname, nodeid = roundupdb.splitDesignator(designator) |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
215 cl = db.getclass(classname) |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
216 properties = cl.getprops() |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
217 for key, value in props.items(): |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
218 type = properties[key] |
|
224
ad2c98faec97
using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
219 if isinstance(type, hyperdb.String): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
220 continue |
|
270
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
221 elif isinstance(type, hyperdb.Password): |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
222 props[key] = password.Password(value) |
|
224
ad2c98faec97
using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
223 elif isinstance(type, hyperdb.Date): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
224 props[key] = date.Date(value) |
|
224
ad2c98faec97
using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
225 elif isinstance(type, hyperdb.Interval): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
226 props[key] = date.Interval(value) |
|
224
ad2c98faec97
using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
227 elif isinstance(type, hyperdb.Link): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
228 props[key] = value |
|
224
ad2c98faec97
using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
229 elif isinstance(type, hyperdb.Multilink): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
230 props[key] = value.split(',') |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
231 apply(cl.set, (nodeid, ), props) |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
232 return 0 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
233 |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
234 def do_find(db, args, comma_sep=0): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
235 '''Usage: find classname propname=value ... |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
236 Find the nodes of the given class with a given property value. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
237 |
|
167
a49c8a2ddd26
Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents:
160
diff
changeset
|
238 Find the nodes of the given class with a given property value. The |
|
a49c8a2ddd26
Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents:
160
diff
changeset
|
239 value may be either the nodeid of the linked node, or its key value. |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
240 ''' |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
241 classname = args[0] |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
242 cl = db.getclass(classname) |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
243 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
244 # look up the linked-to class and get the nodeid that has the value |
|
167
a49c8a2ddd26
Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents:
160
diff
changeset
|
245 propname, value = args[1].split('=') |
|
a49c8a2ddd26
Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents:
160
diff
changeset
|
246 num_re = re.compile('^\d+$') |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
247 if not num_re.match(value): |
|
167
a49c8a2ddd26
Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents:
160
diff
changeset
|
248 propcl = cl.properties[propname].classname |
|
a49c8a2ddd26
Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents:
160
diff
changeset
|
249 propcl = db.getclass(propcl) |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
250 value = propcl.lookup(value) |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
251 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
252 # now do the find |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
253 if comma_sep: |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
254 print ','.join(cl.find(**{propname: value})) |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
255 else: |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
256 print cl.find(**{propname: value}) |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
257 return 0 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
258 |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
259 def do_spec(db, args, comma_sep=0): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
260 '''Usage: spec classname |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
261 Show the properties for a classname. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
262 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
263 This lists the properties for a given class. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
264 ''' |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
265 classname = args[0] |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
266 cl = db.getclass(classname) |
|
262
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
267 keyprop = cl.getkey() |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
268 for key, value in cl.properties.items(): |
|
262
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
269 if keyprop == key: |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
270 print '%s: %s (key property)'%(key, value) |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
271 else: |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
272 print '%s: %s'%(key, value) |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
273 |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
274 def do_create(db, args, comma_sep=0): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
275 '''Usage: create classname property=value ... |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
276 Create a new entry of a given class. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
277 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
278 This creates a new entry of the given class using the property |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
279 name=value arguments provided on the command line after the "create" |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
280 command. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
281 ''' |
|
235
d7d358408537
added missing 'import' statements.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
224
diff
changeset
|
282 from roundup import hyperdb |
|
d7d358408537
added missing 'import' statements.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
224
diff
changeset
|
283 |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
284 classname = args[0] |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
285 cl = db.getclass(classname) |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
286 props = {} |
|
262
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
287 properties = cl.getprops(protected = 0) |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
288 if len(args) == 1: |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
289 # ask for the properties |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
290 for key, value in properties.items(): |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
291 if key == 'id': continue |
|
278
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
292 name = value.__class__.__name__ |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
293 if isinstance(value , hyperdb.Password): |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
294 again = None |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
295 while value != again: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
296 value = getpass.getpass('%s (Password): '%key.capitalize()) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
297 again = getpass.getpass(' %s (Again): '%key.capitalize()) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
298 if value != again: print 'Sorry, try again...' |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
299 if value: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
300 props[key] = value |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
301 else: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
302 value = raw_input('%s (%s): '%(key.capitalize(), name)) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
303 if value: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
304 props[key] = value |
|
262
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
305 else: |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
306 # use the args |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
307 for prop in args[1:]: |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
308 key, value = prop.split('=') |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
309 props[key] = value |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
310 |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
311 # convert types |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
312 for key in props.keys(): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
313 type = properties[key] |
|
262
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
314 if isinstance(type, hyperdb.Date): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
315 props[key] = date.Date(value) |
|
224
ad2c98faec97
using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
316 elif isinstance(type, hyperdb.Interval): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
317 props[key] = date.Interval(value) |
|
278
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
318 elif isinstance(type, hyperdb.Password): |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
319 props[key] = password.Password(value) |
|
224
ad2c98faec97
using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
320 elif isinstance(type, hyperdb.Multilink): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
321 props[key] = value.split(',') |
|
262
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
322 |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
323 if cl.getkey() and not props.has_key(cl.getkey()): |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
324 print "You must provide the '%s' property."%cl.getkey() |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
325 else: |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
326 print apply(cl.create, (), props) |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
327 |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
328 return 0 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
329 |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
330 def do_list(db, args, comma_sep=0): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
331 '''Usage: list classname [property] |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
332 List the instances of a class. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
333 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
334 Lists all instances of the given class along. If the property is not |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
335 specified, the "label" property is used. The label property is tried |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
336 in order: the key, "name", "title" and then the first property, |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
337 alphabetically. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
338 ''' |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
339 classname = args[0] |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
340 cl = db.getclass(classname) |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
341 if len(args) > 1: |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
342 key = args[1] |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
343 else: |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
344 key = cl.labelprop() |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
345 if comma_sep: |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
346 print ','.join(cl.list()) |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
347 else: |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
348 for nodeid in cl.list(): |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
349 value = cl.get(nodeid, key) |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
350 print "%4s: %s"%(nodeid, value) |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
351 return 0 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
352 |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
353 def do_history(db, args, comma_sep=0): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
354 '''Usage: history designator |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
355 Show the history entries of a designator. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
356 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
357 Lists the journal entries for the node identified by the designator. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
358 ''' |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
359 classname, nodeid = roundupdb.splitDesignator(args[0]) |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
360 # TODO: handle the -c option? |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
361 print db.getclass(classname).history(nodeid) |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
362 return 0 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
363 |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
364 def do_retire(db, args, comma_sep=0): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
365 '''Usage: retire designator[,designator]* |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
366 Retire the node specified by designator. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
367 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
368 This action indicates that a particular node is not to be retrieved by |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
369 the list or find commands, and its key value may be re-used. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
370 ''' |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
371 designators = string.split(args[0], ',') |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
372 for designator in designators: |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
373 classname, nodeid = roundupdb.splitDesignator(designator) |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
374 db.getclass(classname).retire(nodeid) |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
375 return 0 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
376 |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
377 def do_export(db, args, comma_sep=0): |
|
278
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
378 '''Usage: export class[,class] destination_dir |
|
285
a6e3a9164814
Marked the roundup-admin import/export as experimental...
Richard Jones <richard@users.sourceforge.net>
parents:
280
diff
changeset
|
379 ** EXPERIMENTAL ** |
|
278
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
380 Export the database to CSV files by class in the given directory. |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
381 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
382 This action exports the current data from the database into |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
383 comma-separated files that are placed in the nominated destination |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
384 directory. The journals are not exported. |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
385 ''' |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
386 if len(args) < 2: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
387 print do_export.__doc__ |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
388 return 1 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
389 classes = string.split(args[0], ',') |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
390 dir = args[1] |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
391 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
392 # use the csv parser if we can - it's faster |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
393 if csv is not None: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
394 p = csv.parser() |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
395 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
396 # do all the classes specified |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
397 for classname in classes: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
398 cl = db.getclass(classname) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
399 f = open(os.path.join(dir, classname+'.csv'), 'w') |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
400 f.write(string.join(cl.properties.keys(), ',') + '\n') |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
401 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
402 # all nodes for this class |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
403 for nodeid in cl.list(): |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
404 if csv is not None: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
405 s = p.join(map(str, cl.getnode(nodeid).values(protected=0))) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
406 f.write(s + '\n') |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
407 else: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
408 l = [] |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
409 # escape the individual entries to they're valid CSV |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
410 for entry in map(str, cl.getnode(nodeid).values(protected=0)): |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
411 if '"' in entry: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
412 entry = '""'.join(entry.split('"')) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
413 if ',' in entry: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
414 entry = '"%s"'%entry |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
415 l.append(entry) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
416 f.write(','.join(l) + '\n') |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
417 return 0 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
418 |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
419 def do_import(db, args, comma_sep=0): |
|
278
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
420 '''Usage: import class file |
|
285
a6e3a9164814
Marked the roundup-admin import/export as experimental...
Richard Jones <richard@users.sourceforge.net>
parents:
280
diff
changeset
|
421 ** EXPERIMENTAL ** |
|
278
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
422 Import the contents of the CSV file as new nodes for the given class. |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
423 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
424 The file must define the same properties as the class (including having |
|
280
80ad2bf9cf7b
The setup.cfg file is just causing pain. Away it goes.
Richard Jones <richard@users.sourceforge.net>
parents:
278
diff
changeset
|
425 a "header" line with those property names.) The new nodes are added to |
|
80ad2bf9cf7b
The setup.cfg file is just causing pain. Away it goes.
Richard Jones <richard@users.sourceforge.net>
parents:
278
diff
changeset
|
426 the existing database - if you want to create a new database using the |
|
80ad2bf9cf7b
The setup.cfg file is just causing pain. Away it goes.
Richard Jones <richard@users.sourceforge.net>
parents:
278
diff
changeset
|
427 imported data, then create a new database (or, tediously, retire all |
|
80ad2bf9cf7b
The setup.cfg file is just causing pain. Away it goes.
Richard Jones <richard@users.sourceforge.net>
parents:
278
diff
changeset
|
428 the old data.) |
|
278
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
429 ''' |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
430 if len(args) < 2: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
431 print do_export.__doc__ |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
432 return 1 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
433 if csv is None: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
434 print 'Sorry, you need the csv module to use this function.' |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
435 print 'Get it from: http://www.object-craft.com.au/projects/csv/' |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
436 return 1 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
437 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
438 from roundup import hyperdb |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
439 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
440 # ensure that the properties and the CSV file headings match |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
441 cl = db.getclass(args[0]) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
442 f = open(args[1]) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
443 p = csv.parser() |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
444 file_props = p.parse(f.readline()) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
445 props = cl.properties.keys() |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
446 m = file_props[:] |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
447 m.sort() |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
448 props.sort() |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
449 if m != props: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
450 print do_export.__doc__ |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
451 print "\n\nFile doesn't define the same properties" |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
452 return 1 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
453 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
454 # loop through the file and create a node for each entry |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
455 n = range(len(props)) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
456 while 1: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
457 line = f.readline() |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
458 if not line: break |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
459 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
460 # parse lines until we get a complete entry |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
461 while 1: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
462 l = p.parse(line) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
463 if l: break |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
464 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
465 # make the new node's property map |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
466 d = {} |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
467 for i in n: |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
468 value = l[i] |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
469 key = file_props[i] |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
470 type = cl.properties[key] |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
471 if isinstance(type, hyperdb.Date): |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
472 value = date.Date(value) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
473 elif isinstance(type, hyperdb.Interval): |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
474 value = date.Interval(value) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
475 elif isinstance(type, hyperdb.Password): |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
476 pwd = password.Password() |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
477 pwd.unpack(value) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
478 value = pwd |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
479 elif isinstance(type, hyperdb.Multilink): |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
480 value = value.split(',') |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
481 d[key] = value |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
482 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
483 # and create the new node |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
484 apply(cl.create, (), d) |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
485 return 0 |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
486 |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
487 def do_freshen(db, args, comma_sep=0): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
488 '''Usage: freshen |
|
153
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
489 Freshen an existing instance. **DO NOT USE** |
|
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
490 |
|
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
491 This currently kills databases!!!! |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
492 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
493 This action should generally not be used. It reads in an instance |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
494 database and writes it again. In the future, is may also update |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
495 instance code to account for changes in templates. It's probably wise |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
496 not to use it anyway. Until we're sure it won't break things... |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
497 ''' |
|
153
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
498 # for classname, cl in db.classes.items(): |
|
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
499 # properties = cl.properties.items() |
|
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
500 # for nodeid in cl.list(): |
|
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
501 # node = {} |
|
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
502 # for name, type in properties: |
|
224
ad2c98faec97
using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
503 # isinstance( if type, hyperdb.Multilink): |
|
153
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
504 # node[name] = cl.get(nodeid, name, []) |
|
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
505 # else: |
|
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
506 # node[name] = cl.get(nodeid, name, None) |
|
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
507 # db.setnode(classname, nodeid, node) |
|
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
508 return 1 |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
509 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
510 def figureCommands(): |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
511 d = {} |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
512 for k, v in globals().items(): |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
513 if k[:3] == 'do_': |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
514 d[k[3:]] = v |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
515 return d |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
516 |
|
291
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
517 def figureHelp(): |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
518 d = {} |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
519 for k, v in globals().items(): |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
520 if k[:5] == 'help_': |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
521 d[k[5:]] = v |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
522 return d |
|
160
002249ffa5d0
init help now lists templates and backends
Richard Jones <richard@users.sourceforge.net>
parents:
153
diff
changeset
|
523 |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
524 def main(): |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
525 opts, args = getopt.getopt(sys.argv[1:], 'i:u:hc') |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
526 |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
527 # handle command-line args |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
528 instance_home = os.environ.get('ROUNDUP_INSTANCE', '') |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
529 name = password = '' |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
530 if os.environ.has_key('ROUNDUP_LOGIN'): |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
531 l = os.environ['ROUNDUP_LOGIN'].split(':') |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
532 name = l[0] |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
533 if len(l) > 1: |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
534 password = l[1] |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
535 comma_sep = 0 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
536 for opt, arg in opts: |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
537 if opt == '-h': |
|
291
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
538 args = ['help'] |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
539 break |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
540 if opt == '-i': |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
541 instance_home = arg |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
542 if opt == '-c': |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
543 comma_sep = 1 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
544 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
545 # figure the command |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
546 if not args: |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
547 usage('No command specified') |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
548 return 1 |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
549 command = args[0] |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
550 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
551 # handle help now |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
552 if command == 'help': |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
553 if len(args)>1: |
|
291
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
554 do_help(args[1:]) |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
555 return 0 |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
556 usage() |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
557 return 0 |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
558 if command == 'morehelp': |
|
291
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
559 usage() |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
560 help_all() |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
561 return 0 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
562 |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
563 # make sure we have an instance_home |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
564 while not instance_home: |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
565 instance_home = raw_input('Enter instance home: ').strip() |
|
137
4a87e0b0d3f7
Made the "init" prompting more friendly.
Richard Jones <richard@users.sourceforge.net>
parents:
127
diff
changeset
|
566 |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
567 # before we open the db, we may be doing an init |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
568 if command == 'init': |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
569 return do_init(instance_home, args) |
|
137
4a87e0b0d3f7
Made the "init" prompting more friendly.
Richard Jones <richard@users.sourceforge.net>
parents:
127
diff
changeset
|
570 |
|
153
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
571 function = figureCommands().get(command, None) |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
572 |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
573 # not a valid command |
|
153
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
574 if function is None: |
|
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
575 usage('Unknown command "%s"'%command) |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
576 return 1 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
577 |
|
270
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
578 # get the instance |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
579 instance = roundup.instance.open(instance_home) |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
580 db = instance.open('admin') |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
581 |
|
274
79226fbb7741
Spit out command help if roundup-admin command doesn't get an argument.
Richard Jones <richard@users.sourceforge.net>
parents:
270
diff
changeset
|
582 if len(args) < 2: |
|
79226fbb7741
Spit out command help if roundup-admin command doesn't get an argument.
Richard Jones <richard@users.sourceforge.net>
parents:
270
diff
changeset
|
583 print function.__doc__ |
|
79226fbb7741
Spit out command help if roundup-admin command doesn't get an argument.
Richard Jones <richard@users.sourceforge.net>
parents:
270
diff
changeset
|
584 return 1 |
|
79226fbb7741
Spit out command help if roundup-admin command doesn't get an argument.
Richard Jones <richard@users.sourceforge.net>
parents:
270
diff
changeset
|
585 |
|
270
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
586 # do the command |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
587 try: |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
588 return function(db, args[1:], comma_sep=comma_sep) |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
589 finally: |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
590 db.close() |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
591 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
592 return 1 |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
593 |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
594 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
595 if __name__ == '__main__': |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
596 sys.exit(main()) |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
597 |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
598 # |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
599 # $Log: not supported by cvs2svn $ |
|
291
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
600 # Revision 1.27 2001/10/11 23:43:04 richard |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
601 # Implemented the comma-separated printing option in the admin tool. |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
602 # Fixed a typo (more of a vim-o actually :) in mailgw. |
|
ee7705d7bb06
More help in admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
287
diff
changeset
|
603 # |
|
287
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
604 # Revision 1.26 2001/10/11 05:03:51 richard |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
605 # Marked the roundup-admin import/export as experimental since they're not fully |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
606 # operational. |
|
ee2f4cb160bd
Implemented the comma-separated printing option in the admin tool.
Richard Jones <richard@users.sourceforge.net>
parents:
285
diff
changeset
|
607 # |
|
285
a6e3a9164814
Marked the roundup-admin import/export as experimental...
Richard Jones <richard@users.sourceforge.net>
parents:
280
diff
changeset
|
608 # Revision 1.25 2001/10/10 04:12:32 richard |
|
a6e3a9164814
Marked the roundup-admin import/export as experimental...
Richard Jones <richard@users.sourceforge.net>
parents:
280
diff
changeset
|
609 # The setup.cfg file is just causing pain. Away it goes. |
|
a6e3a9164814
Marked the roundup-admin import/export as experimental...
Richard Jones <richard@users.sourceforge.net>
parents:
280
diff
changeset
|
610 # |
|
280
80ad2bf9cf7b
The setup.cfg file is just causing pain. Away it goes.
Richard Jones <richard@users.sourceforge.net>
parents:
278
diff
changeset
|
611 # Revision 1.24 2001/10/10 03:54:57 richard |
|
80ad2bf9cf7b
The setup.cfg file is just causing pain. Away it goes.
Richard Jones <richard@users.sourceforge.net>
parents:
278
diff
changeset
|
612 # Added database importing and exporting through CSV files. |
|
80ad2bf9cf7b
The setup.cfg file is just causing pain. Away it goes.
Richard Jones <richard@users.sourceforge.net>
parents:
278
diff
changeset
|
613 # Uses the csv module from object-craft for exporting if it's available. |
|
80ad2bf9cf7b
The setup.cfg file is just causing pain. Away it goes.
Richard Jones <richard@users.sourceforge.net>
parents:
278
diff
changeset
|
614 # Requires the csv module for importing. |
|
80ad2bf9cf7b
The setup.cfg file is just causing pain. Away it goes.
Richard Jones <richard@users.sourceforge.net>
parents:
278
diff
changeset
|
615 # |
|
278
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
616 # Revision 1.23 2001/10/09 23:36:25 richard |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
617 # Spit out command help if roundup-admin command doesn't get an argument. |
|
a5dabf2430c5
Added database importing and exporting through CSV files.
Richard Jones <richard@users.sourceforge.net>
parents:
274
diff
changeset
|
618 # |
|
274
79226fbb7741
Spit out command help if roundup-admin command doesn't get an argument.
Richard Jones <richard@users.sourceforge.net>
parents:
270
diff
changeset
|
619 # Revision 1.22 2001/10/09 07:25:59 richard |
|
79226fbb7741
Spit out command help if roundup-admin command doesn't get an argument.
Richard Jones <richard@users.sourceforge.net>
parents:
270
diff
changeset
|
620 # Added the Password property type. See "pydoc roundup.password" for |
|
79226fbb7741
Spit out command help if roundup-admin command doesn't get an argument.
Richard Jones <richard@users.sourceforge.net>
parents:
270
diff
changeset
|
621 # implementation details. Have updated some of the documentation too. |
|
79226fbb7741
Spit out command help if roundup-admin command doesn't get an argument.
Richard Jones <richard@users.sourceforge.net>
parents:
270
diff
changeset
|
622 # |
|
270
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
623 # Revision 1.21 2001/10/05 02:23:24 richard |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
624 # . roundup-admin create now prompts for property info if none is supplied |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
625 # on the command-line. |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
626 # . hyperdb Class getprops() method may now return only the mutable |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
627 # properties. |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
628 # . Login now uses cookies, which makes it a whole lot more flexible. We can |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
629 # now support anonymous user access (read-only, unless there's an |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
630 # "anonymous" user, in which case write access is permitted). Login |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
631 # handling has been moved into cgi_client.Client.main() |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
632 # . The "extended" schema is now the default in roundup init. |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
633 # . The schemas have had their page headings modified to cope with the new |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
634 # login handling. Existing installations should copy the interfaces.py |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
635 # file from the roundup lib directory to their instance home. |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
636 # . Incorrectly had a Bizar Software copyright on the cgitb.py module from |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
637 # Ping - has been removed. |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
638 # . Fixed a whole bunch of places in the CGI interface where we should have |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
639 # been returning Not Found instead of throwing an exception. |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
640 # . Fixed a deviation from the spec: trying to modify the 'id' property of |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
641 # an item now throws an exception. |
|
a4241ddd22d7
Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents:
264
diff
changeset
|
642 # |
|
264
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
262
diff
changeset
|
643 # Revision 1.20 2001/10/04 02:12:42 richard |
|
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
262
diff
changeset
|
644 # Added nicer command-line item adding: passing no arguments will enter an |
|
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
262
diff
changeset
|
645 # interactive more which asks for each property in turn. While I was at it, I |
|
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
262
diff
changeset
|
646 # fixed an implementation problem WRT the spec - I wasn't raising a |
|
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
262
diff
changeset
|
647 # ValueError if the key property was missing from a create(). Also added a |
|
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
262
diff
changeset
|
648 # protected=boolean argument to getprops() so we can list only the mutable |
|
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
262
diff
changeset
|
649 # properties (defaults to yes, which lists the immutables). |
|
a671e5917b33
Many features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
262
diff
changeset
|
650 # |
|
262
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
651 # Revision 1.19 2001/10/01 06:40:43 richard |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
652 # made do_get have the args in the correct order |
|
ab921dc53ccd
Added nicer command-line item adding:
Richard Jones <richard@users.sourceforge.net>
parents:
261
diff
changeset
|
653 # |
|
261
0ca5381a72b5
made do_get have the args in the correct order
Richard Jones <richard@users.sourceforge.net>
parents:
248
diff
changeset
|
654 # Revision 1.18 2001/09/18 22:58:37 richard |
|
0ca5381a72b5
made do_get have the args in the correct order
Richard Jones <richard@users.sourceforge.net>
parents:
248
diff
changeset
|
655 # |
|
0ca5381a72b5
made do_get have the args in the correct order
Richard Jones <richard@users.sourceforge.net>
parents:
248
diff
changeset
|
656 # Added some more help to roundu-admin |
|
0ca5381a72b5
made do_get have the args in the correct order
Richard Jones <richard@users.sourceforge.net>
parents:
248
diff
changeset
|
657 # |
|
248
96cdd8ef0581
Added some more help to roundup-admin
Richard Jones <richard@users.sourceforge.net>
parents:
235
diff
changeset
|
658 # Revision 1.17 2001/08/28 05:58:33 anthonybaxter |
|
96cdd8ef0581
Added some more help to roundup-admin
Richard Jones <richard@users.sourceforge.net>
parents:
235
diff
changeset
|
659 # added missing 'import' statements. |
|
96cdd8ef0581
Added some more help to roundup-admin
Richard Jones <richard@users.sourceforge.net>
parents:
235
diff
changeset
|
660 # |
|
235
d7d358408537
added missing 'import' statements.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
224
diff
changeset
|
661 # Revision 1.16 2001/08/12 06:32:36 richard |
|
d7d358408537
added missing 'import' statements.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
224
diff
changeset
|
662 # using isinstance(blah, Foo) now instead of isFooType |
|
d7d358408537
added missing 'import' statements.
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
224
diff
changeset
|
663 # |
|
224
ad2c98faec97
using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
664 # Revision 1.15 2001/08/07 00:24:42 richard |
|
ad2c98faec97
using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
665 # stupid typo |
|
ad2c98faec97
using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents:
214
diff
changeset
|
666 # |
| 214 | 667 # Revision 1.14 2001/08/07 00:15:51 richard |
| 668 # Added the copyright/license notice to (nearly) all files at request of | |
| 669 # Bizar Software. | |
| 670 # | |
|
213
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
671 # Revision 1.13 2001/08/05 07:44:13 richard |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
672 # Instances are now opened by a special function that generates a unique |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
673 # module name for the instances on import time. |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
204
diff
changeset
|
674 # |
|
204
c1461733cbf9
Instances are now opened by a special function...
Richard Jones <richard@users.sourceforge.net>
parents:
193
diff
changeset
|
675 # Revision 1.12 2001/08/03 01:28:33 richard |
|
c1461733cbf9
Instances are now opened by a special function...
Richard Jones <richard@users.sourceforge.net>
parents:
193
diff
changeset
|
676 # Used the much nicer load_package, pointed out by Steve Majewski. |
|
c1461733cbf9
Instances are now opened by a special function...
Richard Jones <richard@users.sourceforge.net>
parents:
193
diff
changeset
|
677 # |
|
193
241a0323aacb
Used the much nicer load_package, pointed out by Steve Majewski.
Richard Jones <richard@users.sourceforge.net>
parents:
190
diff
changeset
|
678 # Revision 1.11 2001/08/03 00:59:34 richard |
|
241a0323aacb
Used the much nicer load_package, pointed out by Steve Majewski.
Richard Jones <richard@users.sourceforge.net>
parents:
190
diff
changeset
|
679 # Instance import now imports the instance using imp.load_module so that |
|
241a0323aacb
Used the much nicer load_package, pointed out by Steve Majewski.
Richard Jones <richard@users.sourceforge.net>
parents:
190
diff
changeset
|
680 # we can have instance homes of "roundup" or other existing python package |
|
241a0323aacb
Used the much nicer load_package, pointed out by Steve Majewski.
Richard Jones <richard@users.sourceforge.net>
parents:
190
diff
changeset
|
681 # names. |
|
241a0323aacb
Used the much nicer load_package, pointed out by Steve Majewski.
Richard Jones <richard@users.sourceforge.net>
parents:
190
diff
changeset
|
682 # |
|
190
996eaf90c01e
Instance import now imports the instance using imp.load_module...
Richard Jones <richard@users.sourceforge.net>
parents:
167
diff
changeset
|
683 # Revision 1.10 2001/07/30 08:12:17 richard |
|
996eaf90c01e
Instance import now imports the instance using imp.load_module...
Richard Jones <richard@users.sourceforge.net>
parents:
167
diff
changeset
|
684 # Added time logging and file uploading to the templates. |
|
996eaf90c01e
Instance import now imports the instance using imp.load_module...
Richard Jones <richard@users.sourceforge.net>
parents:
167
diff
changeset
|
685 # |
|
167
a49c8a2ddd26
Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents:
160
diff
changeset
|
686 # Revision 1.9 2001/07/30 03:52:55 richard |
|
a49c8a2ddd26
Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents:
160
diff
changeset
|
687 # init help now lists templates and backends |
|
a49c8a2ddd26
Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents:
160
diff
changeset
|
688 # |
|
160
002249ffa5d0
init help now lists templates and backends
Richard Jones <richard@users.sourceforge.net>
parents:
153
diff
changeset
|
689 # Revision 1.8 2001/07/30 02:37:07 richard |
|
002249ffa5d0
init help now lists templates and backends
Richard Jones <richard@users.sourceforge.net>
parents:
153
diff
changeset
|
690 # Freshen is really broken. Commented out. |
|
002249ffa5d0
init help now lists templates and backends
Richard Jones <richard@users.sourceforge.net>
parents:
153
diff
changeset
|
691 # |
|
153
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
692 # Revision 1.7 2001/07/30 01:28:46 richard |
|
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
693 # Bugfixes |
|
b07b9a5b6aa9
Freshen is really broken. Commented out.
Richard Jones <richard@users.sourceforge.net>
parents:
147
diff
changeset
|
694 # |
| 147 | 695 # Revision 1.6 2001/07/30 00:57:51 richard |
| 696 # Now uses getopt, much improved command-line parsing. Much fuller help. Much | |
| 697 # better internal structure. It's just BETTER. :) | |
| 698 # | |
|
140
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
699 # Revision 1.5 2001/07/30 00:04:48 richard |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
700 # Made the "init" prompting more friendly. |
|
a4383d62a407
Now uses getopt, much improved command-line parsing.
Richard Jones <richard@users.sourceforge.net>
parents:
137
diff
changeset
|
701 # |
|
137
4a87e0b0d3f7
Made the "init" prompting more friendly.
Richard Jones <richard@users.sourceforge.net>
parents:
127
diff
changeset
|
702 # Revision 1.4 2001/07/29 07:01:39 richard |
|
4a87e0b0d3f7
Made the "init" prompting more friendly.
Richard Jones <richard@users.sourceforge.net>
parents:
127
diff
changeset
|
703 # Added vim command to all source so that we don't get no steenkin' tabs :) |
|
4a87e0b0d3f7
Made the "init" prompting more friendly.
Richard Jones <richard@users.sourceforge.net>
parents:
127
diff
changeset
|
704 # |
|
127
0791d13baea7
Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents:
51
diff
changeset
|
705 # Revision 1.3 2001/07/23 08:45:28 richard |
|
0791d13baea7
Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents:
51
diff
changeset
|
706 # ok, so now "./roundup-admin init" will ask questions in an attempt to get a |
|
0791d13baea7
Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents:
51
diff
changeset
|
707 # workable instance_home set up :) |
|
0791d13baea7
Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents:
51
diff
changeset
|
708 # _and_ anydbm has had its first test :) |
|
0791d13baea7
Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents:
51
diff
changeset
|
709 # |
|
51
3a7e5515c1bd
ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents:
48
diff
changeset
|
710 # Revision 1.2 2001/07/23 08:20:44 richard |
|
3a7e5515c1bd
ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents:
48
diff
changeset
|
711 # Moved over to using marshal in the bsddb and anydbm backends. |
|
3a7e5515c1bd
ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents:
48
diff
changeset
|
712 # roundup-admin now has a "freshen" command that'll load/save all nodes (not |
|
3a7e5515c1bd
ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents:
48
diff
changeset
|
713 # retired - mod hyperdb.Class.list() so it lists retired nodes) |
|
3a7e5515c1bd
ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents:
48
diff
changeset
|
714 # |
|
48
671203878652
Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents:
27
diff
changeset
|
715 # Revision 1.1 2001/07/23 03:46:48 richard |
|
671203878652
Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents:
27
diff
changeset
|
716 # moving the bin files to facilitate out-of-the-boxness |
|
671203878652
Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents:
27
diff
changeset
|
717 # |
|
27
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
718 # Revision 1.1 2001/07/22 11:15:45 richard |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
719 # More Grande Splite stuff |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
720 # |
|
e5e9ea306a09
moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
721 # |
|
127
0791d13baea7
Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents:
51
diff
changeset
|
722 # vim: set filetype=python ts=4 sw=4 et si |
