def doIt(self, dbg): """ Converts request into python variable """ try: xml = "<xml>" valDict = pydevd_vars.resolveCompoundVariable(self.thread_id, self.frame_id, self.scope, self.attributes) if valDict is None: valDict = {} keys = valDict.keys() if hasattr(keys, 'sort'): keys.sort(compare_object_attrs) #Python 3.0 does not have it else: if IS_PY3K: keys = sorted(keys, key=cmp_to_key(compare_object_attrs)) #Jython 2.1 does not have it (and all must be compared as strings). else: keys = sorted(keys, cmp=compare_object_attrs) #Jython 2.1 does not have it (and all must be compared as strings). for k in keys: xml += pydevd_vars.varToXML(valDict[k], to_string(k)) xml += "</xml>" cmd = dbg.cmdFactory.makeGetVariableMessage(self.sequence, xml) dbg.writer.addCommand(cmd) except Exception: cmd = dbg.cmdFactory.makeErrorMessage(self.sequence, "Error resolving variables " + GetExceptionTracebackStr()) dbg.writer.addCommand(cmd)
def doIt(self, dbg): """ Converts request into python variable """ try: xml = "<xml>" valDict = pydevd_vars.resolveCompoundVariable(self.thread_id, self.frame_id, self.scope, self.attributes) keys = valDict.keys() keys.sort() for k in keys: xml += pydevd_vars.varToXML(valDict[k], str(k)) xml += "</xml>" cmd = dbg.cmdFactory.makeGetVariableMessage(self.sequence, xml) dbg.writer.addCommand(cmd) except Exception: cmd = dbg.cmdFactory.makeErrorMessage(self.sequence, "Error resolving variables " + GetExceptionTracebackStr()) dbg.writer.addCommand(cmd)