##// END OF EJS Templates
Minor changes to a few files to reflect design discussion.
Brian Granger -
Show More
@@ -153,7 +153,7 b' NoDefault = NoDefault()'
153 class ArgParseConfigLoader(CommandLineConfigLoader):
153 class ArgParseConfigLoader(CommandLineConfigLoader):
154
154
155 # arguments = [(('-f','--file'),dict(type=str,dest='file'))]
155 # arguments = [(('-f','--file'),dict(type=str,dest='file'))]
156 arguments = []
156 arguments = ()
157
157
158 def __init__(self, *args, **kw):
158 def __init__(self, *args, **kw):
159 """Create a config loader for use with argparse.
159 """Create a config loader for use with argparse.
@@ -45,6 +45,7 b' class TestPyFileCL(TestCase):'
45 f = os.fdopen(fd, 'w')
45 f = os.fdopen(fd, 'w')
46 f.write(pyfile)
46 f.write(pyfile)
47 f.close()
47 f.close()
48 # Unlink the file
48 cl = PyFileConfigLoader(fname)
49 cl = PyFileConfigLoader(fname)
49 config = cl.load_config()
50 config = cl.load_config()
50 self.assertEquals(config.A, 10)
51 self.assertEquals(config.A, 10)
@@ -58,12 +59,12 b' class TestArgParseCL(TestCase):'
58 def test_basic(self):
59 def test_basic(self):
59
60
60 class MyLoader(ArgParseConfigLoader):
61 class MyLoader(ArgParseConfigLoader):
61 arguments = [
62 arguments = (
62 (('-f','--foo'), dict(dest='FOO', type=str)),
63 (('-f','--foo'), dict(dest='FOO', type=str)),
63 (('-b',), dict(dest='BAR', type=int)),
64 (('-b',), dict(dest='BAR', type=int)),
64 (('-n',), dict(dest='N', action='store_true')),
65 (('-n',), dict(dest='N', action='store_true')),
65 (('BAM',), dict(type=str))
66 (('BAM',), dict(type=str))
66 ]
67 )
67
68
68 cl = MyLoader()
69 cl = MyLoader()
69 config = cl.load_config('-f hi -b 10 -n wow'.split())
70 config = cl.load_config('-f hi -b 10 -n wow'.split())
@@ -32,17 +32,19 b' Questions:'
32
32
33
33
34 * Can we limit ourselves to 1 config file or do we want to have a sequence
34 * Can we limit ourselves to 1 config file or do we want to have a sequence
35 of them like IPYTHONDIR->RUNTIMEDIR->CWD?
35 of them like IPYTHONDIR->RUNTIMEDIR->CWD? [1]
36 * Do we need a debug mode that has custom exception handling and can drop
36 * Do we need a debug mode that has custom exception handling and can drop
37 into pdb upno startup?
37 into pdb upno startup? N
38 * Do we need to use an OutputTrap to capture output and then present it
38 * Do we need to use an OutputTrap to capture output and then present it
39 to a user if startup fails?
39 to a user if startup fails? N
40 * Do we want the location of the config file(s) to be independent of the
40 * Do we want the location of the config file(s) to be independent of the
41 ipython/runtime dir or coupled to it. In other words, can the user select
41 ipython/runtime dir or coupled to it. In other words, can the user select
42 a config file that is outside their runtime/ipython dir. One model is
42 a config file that is outside their runtime/ipython dir. One model is
43 that we could have a very strict model of IPYTHONDIR=runtimed dir=
43 that we could have a very strict model of IPYTHONDIR=runtimed dir=
44 dir used for all config.
44 dir used for all config.
45 * Do we install default config files or not?
45 * Do we install default config files or not? N
46
47 * attempt needs to either clash or to die
46 """
48 """
47
49
48 #-----------------------------------------------------------------------------
50 #-----------------------------------------------------------------------------
General Comments 0
You need to be logged in to leave comments. Login now