Skip to content

Commit ef92d63

Browse files
author
gsherman
committedMar 24, 2007
Escape <> in python console output so python object display
git-svn-id: http://svn.osgeo.org/qgis/trunk@6829 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent c09e954 commit ef92d63

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed
 

‎src/app/qgspythondialog.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@ void QgsPythonDialog::on_edtCmdLine_returnPressed()
4343
{
4444
QgsPythonUtils::evalString("sys.stdout.data", output);
4545
QgsPythonUtils::runString("sys.stdout.data = ''");
46-
47-
output += QgsPythonUtils::getResult();
46+
QString result = QgsPythonUtils::getResult();
47+
// escape the result so python objects display properly and
48+
// we can still use html output to get nicely formatted display
49+
result.replace("<","&lt;");
50+
result.replace(">","&gt;");
51+
output += result;
4852

4953
if (!output.isEmpty())
5054
output += "<br>";
@@ -56,8 +60,8 @@ void QgsPythonDialog::on_edtCmdLine_returnPressed()
5660

5761
output = "<font color=\"red\">" + className + ": " + errorText + "</font><br>";
5862
}
59-
60-
QString str = "<b><font color=\"green\">>>></font> " + command + "</b><br>" + output;
63+
64+
QString str = "<b><font color=\"green\">>>></font> " + command.replace("<","&lt;") + "</b><br>" + output;
6165
txtHistory->setText(txtHistory->text() + str);
6266
edtCmdLine->setText("");
6367

0 commit comments

Comments
 (0)
Please sign in to comment.