Commits

Georg Brandl committed 9444d5a

Closes #859: Fix exception under certain circumstances when not finding appropriate objects to link to.

Comments (0)

Files changed (2)

 * #695: When the highlight language "python" is specified explicitly,
   do not try to parse the code to recognize non-Python snippets.
 
+* #859: Fix exception under certain circumstances when not finding
+  appropriate objects to link to.
+
 
 Release 1.1.2 (Nov 1, 2011) -- 1.1.1 is a silly version number anyway!
 ======================================================================

sphinx/domains/python.py

         newname = None
         if searchmode == 1:
             objtypes = self.objtypes_for_role(type)
-            if modname and classname:
-                fullname = modname + '.' + classname + '.' + name
-                if fullname in objects and objects[fullname][1] in objtypes:
-                    newname = fullname
-            if not newname:
-                if modname and modname + '.' + name in objects and \
-                   objects[modname + '.' + name][1] in objtypes:
-                    newname = modname + '.' + name
-                elif name in objects and objects[name][1] in objtypes:
-                    newname = name
-                else:
-                    # "fuzzy" searching mode
-                    searchname = '.' + name
-                    matches = [(oname, objects[oname]) for oname in objects
-                               if oname.endswith(searchname)
-                               and objects[oname][1] in objtypes]
+            if objtypes is not None:
+                if modname and classname:
+                    fullname = modname + '.' + classname + '.' + name
+                    if fullname in objects and objects[fullname][1] in objtypes:
+                        newname = fullname
+                if not newname:
+                    if modname and modname + '.' + name in objects and \
+                       objects[modname + '.' + name][1] in objtypes:
+                        newname = modname + '.' + name
+                    elif name in objects and objects[name][1] in objtypes:
+                        newname = name
+                    else:
+                        # "fuzzy" searching mode
+                        searchname = '.' + name
+                        matches = [(oname, objects[oname]) for oname in objects
+                                   if oname.endswith(searchname)
+                                   and objects[oname][1] in objtypes]
         else:
             # NOTE: searching for exact match, object type is not considered
             if name in objects: