Repository: spyder-ide/spyder

Issue:
Object Inspector is not showing "No documentation available" for objects without docstring
It seems Jedi returns `<no docstring>` instead of an empty string for objects without docstring. This prevents the Object Inspector to show the _No documentation available_ warning page.



Discussion:
@blink1073, can you take a look at it?

Here's what I see (which was part of my last PR on Bitbucket), which I think is preferable since it at least shows some information about the function.

![screenshot from 2015-03-13 08 35 55](https://cloud.githubusercontent.com/assets/2096628/6639240/fed9bd40-c95b-11e4-98eb-6afa254acb5d.png)

Maybe `No documentation available.` would be better than `<no docstring>` which looks too computer-y. A full sentence (even without a verb) is nicer than an html opening tag...

`<fine>`


Resolving patch:
diff --git a/spyderlib/plugins/inspector.py b/spyderlib/plugins/inspector.py
--- a/spyderlib/plugins/inspector.py
+++ b/spyderlib/plugins/inspector.py
@@ -325,8 +325,7 @@ def run(self):
         html_text = self.html_text_no_doc
         doc = self.doc
         if doc is not None:
-            if type(doc) is dict and 'docstring' in doc.keys() \
-              and doc['docstring'] != '':
+            if type(doc) is dict and 'docstring' in doc.keys():
                 try:
                     context = generate_context(name=doc['name'],
                                                argspec=doc['argspec'],
@@ -334,6 +333,10 @@ def run(self):
                                                math=self.math_option,
                                                img_path=self.img_path)
                     html_text = sphinxify(doc['docstring'], context)
+                    if doc['docstring'] == '':
+                        html_text += '<div class="hr"></div>'
+                        html_text += self.html_text_no_doc
+
                 except Exception as error:
                     self.error_msg.emit(to_text_string(error))
                     return
diff --git a/spyderlib/utils/introspection/plugin_manager.py b/spyderlib/utils/introspection/plugin_manager.py
--- a/spyderlib/utils/introspection/plugin_manager.py
+++ b/spyderlib/utils/introspection/plugin_manager.py
@@ -443,9 +443,6 @@ def _handle_info_response(self, resp, info, prev_info):
                                      at_position=prev_info.position)
 
         if resp['name']:
-            if not resp['docstring']:
-                resp['docstring'] = '<no docstring>'
-
             self.send_to_inspector.emit(
                 resp['name'], resp['argspec'],
                 resp['note'], resp['docstring'],
diff --git a/spyderlib/utils/introspection/rope_plugin.py b/spyderlib/utils/introspection/rope_plugin.py
--- a/spyderlib/utils/introspection/rope_plugin.py
+++ b/spyderlib/utils/introspection/rope_plugin.py
@@ -167,7 +167,7 @@ def handle_info(self, cts, doc_text, source_code, offset):
                     calltip = getsignaturefromtext(doc_text, obj_name)
         if not obj_fullname:
             obj_fullname = sourcecode.get_primary_at(source_code, offset)
-        if obj_fullname and not obj_fullname.startswith('self.') and doc_text:
+        if obj_fullname and not obj_fullname.startswith('self.'):
             # doc_text was generated by utils.dochelpers.getdoc
             if type(doc_text) is dict:
                 obj_fullname = doc_text['name'] or obj_fullname


Test patch: