summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2015-10-14 22:43:38 -0500
committerMichael Merickel <michael@merickel.org>2015-10-14 22:43:38 -0500
commit7ec9b316306adaf746110e39330848f8842da7cc (patch)
tree7c1d526334374a07c3e94c655e0f23a9b3b3e4d1
parent14a28d2dfd27aed3337fb756180befa15d94ea98 (diff)
parent1c1c908c2cf619461611054672a1c027276398d7 (diff)
downloadpyramid-7ec9b316306adaf746110e39330848f8842da7cc.tar.gz
pyramid-7ec9b316306adaf746110e39330848f8842da7cc.tar.bz2
pyramid-7ec9b316306adaf746110e39330848f8842da7cc.zip
Merge pull request #1929 from jessedhillon/better-pshell-env-help
populate pshell's env_help with docstring of values
-rw-r--r--CONTRIBUTORS.txt2
-rw-r--r--pyramid/scripts/pshell.py5
-rw-r--r--pyramid/tests/test_scripts/test_pshell.py2
3 files changed, 8 insertions, 1 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 3405612ef..cb1117228 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -250,3 +250,5 @@ Contributors
- Karen Dalton, 2015/06/01
- Igor Stroh, 2015/06/10
+
+- Jesse Dhillon, 2015/10/07
diff --git a/pyramid/scripts/pshell.py b/pyramid/scripts/pshell.py
index 5f0df908c..5913220fc 100644
--- a/pyramid/scripts/pshell.py
+++ b/pyramid/scripts/pshell.py
@@ -125,7 +125,10 @@ class PShellCommand(object):
# remove any objects from default help that were overidden
for k, v in env.items():
if k not in orig_env or env[k] != orig_env[k]:
- env_help[k] = v
+ if getattr(v, '__doc__', False):
+ env_help[k] = v.__doc__.replace("\n", " ")
+ else:
+ env_help[k] = v
# load the pshell section of the ini file
env.update(self.loaded_objects)
diff --git a/pyramid/tests/test_scripts/test_pshell.py b/pyramid/tests/test_scripts/test_pshell.py
index 073128f5b..034f2109d 100644
--- a/pyramid/tests/test_scripts/test_pshell.py
+++ b/pyramid/tests/test_scripts/test_pshell.py
@@ -263,6 +263,7 @@ class TestPShellCommand(unittest.TestCase):
def setup(env):
env['a'] = 1
env['root'] = 'root override'
+ env['none'] = None
self.config_factory.items = [('setup', setup)]
shell = dummy.DummyShell()
command.run(shell)
@@ -276,6 +277,7 @@ class TestPShellCommand(unittest.TestCase):
'request':self.bootstrap.request,
'root_factory':self.bootstrap.root_factory,
'a':1,
+ 'none': None,
})
self.assertTrue(self.bootstrap.closer.called)
self.assertTrue(shell.help)