#NEWLINE# def frameVarsToXML( frame ) : #NEWLINE# #INDENT# ' dumps frame variables to XML\n    <var name="var_name" scope="local" type="type" value="value"/>\n    ' #NEWLINE# xml = '' #NEWLINE# keys = frame . f_locals . keys ( ) #NEWLINE# if hasattr ( keys , 'sort' ) : #NEWLINE# #INDENT# keys . sort ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# keys = sorted ( keys ) #NEWLINE# #UNINDENT# for k in keys : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# v = frame . f_locals [ k ] #NEWLINE# xml += varToXML ( v , str ( k ) ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# traceback . print_exc ( ) #NEWLINE# sys . stderr . write ( 'Unexpected error, recovered safely.\n' ) #NEWLINE# #UNINDENT# #UNINDENT# return xml