summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorjaypipes@gmail.com <>2011-01-18 10:25:40 -0500
committerjaypipes@gmail.com <>2011-01-18 10:25:40 -0500
commit2f4e7b732d5cafd09a5a73cbc01583503b8ba105 (patch)
tree38ddcf4266aad34084967df2d00f506ad66987f5 /nova/api
parent785c5df3d17bb158ef2c1a66ce59ee8e6d4236b1 (diff)
downloadnova-2f4e7b732d5cafd09a5a73cbc01583503b8ba105.tar.gz
nova-2f4e7b732d5cafd09a5a73cbc01583503b8ba105.tar.xz
nova-2f4e7b732d5cafd09a5a73cbc01583503b8ba105.zip
Docstrings aren't guaranteed to exist, so split() can't automatically be called on a method without first checking for the method docstring's existence. Fixes Bug #704447
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/direct.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/nova/api/direct.py b/nova/api/direct.py
index 81b3ae202..2dfbcae39 100644
--- a/nova/api/direct.py
+++ b/nova/api/direct.py
@@ -142,9 +142,15 @@ class Reflection(object):
if argspec[2]:
args_out.insert(0, ('**%s' % argspec[2],))
+ if f.__doc__:
+ short_doc = f.__doc__.split('\n')[0]
+ doc = f.__doc__
+ else:
+ short_doc = doc = _('not available')
+
methods['/%s/%s' % (route, k)] = {
- 'short_doc': f.__doc__.split('\n')[0],
- 'doc': f.__doc__,
+ 'short_doc': short_doc,
+ 'doc': doc,
'name': k,
'args': list(reversed(args_out))}