DebugClients/Python3/DebugClientBase.py

changeset 5175
9db0b0f15d12
parent 5171
f1e9eebd5469
child 5184
79b3922094ba
diff -r 632257ad7337 -r 9db0b0f15d12 DebugClients/Python3/DebugClientBase.py
--- a/DebugClients/Python3/DebugClientBase.py	Fri Sep 16 19:34:58 2016 +0200
+++ b/DebugClients/Python3/DebugClientBase.py	Mon Sep 19 20:10:33 2016 +0200
@@ -1441,18 +1441,21 @@
                     DebugVariables.getType(variable)
                 if resolver:
                     variable = resolver.resolve(variable, attribute)
+                    if variable is None:
+                        break
                 else:
                     break
-            typeObject, typeName, typeStr, resolver = \
-                DebugVariables.getType(variable)
-            if typeStr.startswith(("PyQt5.", "PyQt4.")):
-                vlist = self.__formatQtVariable(variable, typeName)
-                varlist.extend(vlist)
-            elif resolver:
-                dict = resolver.getDictionary(variable)
-                vlist = self.__formatVariablesList(
-                    list(dict.keys()), dict, scope, filter)
-                varlist.extend(vlist)
+            if variable is not None:
+                typeObject, typeName, typeStr, resolver = \
+                    DebugVariables.getType(variable)
+                if typeStr.startswith(("PyQt5.", "PyQt4.")):
+                    vlist = self.__formatQtVariable(variable, typeName)
+                    varlist.extend(vlist)
+                elif resolver:
+                    dict = resolver.getDictionary(variable)
+                    vlist = self.__formatVariablesList(
+                        list(dict.keys()), dict, scope, filter)
+                    varlist.extend(vlist)
         
         self.sendJsonCommand("ResponseVariable", {
             "scope": scope,
@@ -1670,11 +1673,15 @@
             else:
                 value = dict[key]
                 valtypestr = str(type(value))[1:-1]
-                
                 valtype = valtypestr[7:-1]
+                valtypename = type(value).__name__
                 if valtype not in ConfigVarTypeStrings:
-                    if ConfigVarTypeStrings.index('instance') in filter:
-                        continue
+                    if valtype == "numpy.ndarray":
+                        if ConfigVarTypeStrings.index('list') in filter:
+                            continue
+                    elif valtypename == "MultiValueDict":
+                        if ConfigVarTypeStrings.index('dict') in filter:
+                            continue
                     elif valtype == "sip.methoddescriptor":
                         if ConfigVarTypeStrings.index(
                                 'method') in filter:
@@ -1682,7 +1689,11 @@
                     elif valtype == "sip.enumtype":
                         if ConfigVarTypeStrings.index('class') in filter:
                             continue
-                    valtype = valtypestr
+                    elif ConfigVarTypeStrings.index('instance') in filter:
+                        continue
+                    
+                    if valtypename not in ["ndarray", "MultiValueDict"]:
+                        valtype = valtypestr
                 else:
                     try:
                         if ConfigVarTypeStrings.index(valtype) in filter:
@@ -1704,17 +1715,22 @@
                             continue
                 
                 try:
-                    if valtype not in ['list', 'tuple', 'dict', 'set',
-                                       'frozenset']:
+                    if valtype in ['list', 'tuple', 'dict', 'set',
+                                   'frozenset']:
+                        if valtype == 'dict':
+                            rvalue = "{0:d}".format(len(value.keys()))
+                        else:
+                            rvalue = "{0:d}".format(len(value))
+                    elif valtype == "numpy.ndarray":
+                        rvalue = "{0:d}".format(value.size)
+                    elif valtypename == "MultiValueDict":
+                        rvalue = "{0:d}".format(len(value.keys()))
+                        valtype = "django.MultiValueDict"  # shortened type
+                    else:
                         rvalue = repr(value)
                         if valtype.startswith('class') and \
                            rvalue[0] in ['{', '(', '[']:
                             rvalue = ""
-                    else:
-                        if valtype == 'dict':
-                            rvalue = "{0:d}".format(len(value.keys()))
-                        else:
-                            rvalue = "{0:d}".format(len(value))
                 except Exception:
                     rvalue = ''
             

eric ide

mercurial