Mercurial > p > roundup > code
changeset 7546:534f8bdb8f94
Add -P pragma=value command line option to roundup-admin.
To set pragmas when using non-interactive mode, or set on command line
when going into interactive mode.
Also changed specification test to use command line pragma setting
rather than interactive. This tests the -P option without having to
run an extra test.
Docs updated as well.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Fri, 14 Jul 2023 00:30:44 -0400 |
| parents | 939fcfdfa370 |
| children | c8c4514f4c3e |
| files | CHANGES.txt doc/admin_guide.txt roundup/admin.py share/man/man1/roundup-admin.1 test/test_admin.py |
| diffstat | 5 files changed, 16 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Fri Jul 14 00:10:42 2023 -0400 +++ b/CHANGES.txt Fri Jul 14 00:30:44 2023 -0400 @@ -21,6 +21,8 @@ - issue2551103 - add pragma 'display_protected' to roundup-admin. If true, print protected attributes like id, activity, actor... when using display or specification subcommands. (John Rouillard) +- add -P pragma=value command line option to roundup-admin. Allows + setting pragmas when using non-interactive mode. (John Rouillard) 2023-07-13 2.3.0
--- a/doc/admin_guide.txt Fri Jul 14 00:10:42 2023 -0400 +++ b/doc/admin_guide.txt Fri Jul 14 00:30:44 2023 -0400 @@ -1248,6 +1248,8 @@ -S <string> -- when outputting lists of data, string-separate them -s -- when outputting lists of data, space-separate them. Same as '-S " "'. + -P pragma=value -- Set a pragma on command line rather than interactively. + Can be used multiple times. -V -- be verbose when importing -v -- report Roundup and Python versions (and quit)
--- a/roundup/admin.py Fri Jul 14 00:10:42 2023 -0400 +++ b/roundup/admin.py Fri Jul 14 00:30:44 2023 -0400 @@ -173,6 +173,8 @@ -S <string> -- when outputting lists of data, string-separate them -s -- when outputting lists of data, space-separate them. Same as '-S " "'. + -P pragma=value -- Set a pragma on command line rather than interactively. + Can be used multiple times. -V -- be verbose when importing -v -- report Roundup and Python versions (and quit) @@ -2114,7 +2116,7 @@ def main(self): try: - opts, args = getopt.getopt(sys.argv[1:], 'i:u:hcdsS:vV') + opts, args = getopt.getopt(sys.argv[1:], 'i:u:hcdP:sS:vV') except getopt.GetoptError as e: self.usage(str(e)) return 1 @@ -2160,6 +2162,8 @@ self.separator = ' ' elif opt == '-d': self.print_designator = 1 + elif opt == '-P': + self.do_pragma([arg]) elif opt == '-u': login_opt = arg.split(':') self.name = login_opt[0]
--- a/share/man/man1/roundup-admin.1 Fri Jul 14 00:10:42 2023 -0400 +++ b/share/man/man1/roundup-admin.1 Fri Jul 14 00:30:44 2023 -0400 @@ -29,6 +29,10 @@ When outputting lists of data, space-separate them. Same as \fB-S " "\fP. .TP +\fB-P pragma=value\fP +Set a pragma on the command line. Multiple \fB-P\fP options can be +specified to set multiple pragmas. +.TP \fB-V\fP Be verbose when importing data. .TP
--- a/test/test_admin.py Fri Jul 14 00:10:42 2023 -0400 +++ b/test/test_admin.py Fri Jul 14 00:30:44 2023 -0400 @@ -1510,18 +1510,15 @@ self.assertEqual(sorted(outlist), sorted(spec)) # ----- - inputs = iter(["pragma display_protected=1", "spec user", "quit"]) - AdminTool.my_input = lambda _self, _prompt: next(inputs) - self.install_init() self.admin=AdminTool() - sys.argv=['main', '-i', self.dirname] with captured_output() as (out, err): + sys.argv=['main', '-i', self.dirname, '-P', + 'display_protected=1', 'specification', 'user'] ret = self.admin.main() - # strip greeting and help text lines - outlist = out.getvalue().strip().split('\n')[2:] + outlist = out.getvalue().strip().split('\n') protected = [ 'id: <roundup.hyperdb.String>', 'creation: <roundup.hyperdb.Date>',
