[glom/glom-1-18] Write Python tracebacks to stderr.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/glom-1-18] Write Python tracebacks to stderr.
- Date: Tue, 12 Apr 2011 15:20:51 +0000 (UTC)
commit a77d75445ed3b824c198b859a92a3ef7e4f8d0ee
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Apr 5 15:28:38 2011 +0200
Write Python tracebacks to stderr.
* glom/application.cc:
* glom/mode_data/box_data.cc:
* glom/mode_design/dialog_database_preferences.cc:
* tests/test_python_execute_script.cc: Output python errors to stderr as a
clue when things go wrong.
ChangeLog | 10 ++++++++++
glom/application.cc | 5 +++++
glom/mode_data/box_data.cc | 8 +++++++-
glom/mode_design/dialog_database_preferences.cc | 5 +++++
tests/test_python_execute_script.cc | 5 +++++
5 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 04d1c47..e3f32df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-04-05 Murray Cumming <murrayc murrayc com>
+
+ Write Python tracebacks to stderr.
+
+ * glom/application.cc:
+ * glom/mode_data/box_data.cc:
+ * glom/mode_design/dialog_database_preferences.cc:
+ * tests/test_python_execute_script.cc: Output python errors to stderr as a
+ clue when things go wrong.
+
2011-04-04 Murray Cumming <murrayc murrayc com>
Fix an error found by the gtkmm change to use operator const void*.
diff --git a/glom/application.cc b/glom/application.cc
index 7e856df..e3693ae 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -1302,6 +1302,11 @@ bool Application::on_document_load()
sharedconnection->get_gda_connection(),
callbacks,
error_message);
+
+ if(!error_message.empty())
+ {
+ std::cerr << "Python Error: " << error_message << std::endl;
+ }
}
#ifndef GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/mode_data/box_data.cc b/glom/mode_data/box_data.cc
index 577b7a3..04bb471 100644
--- a/glom/mode_data/box_data.cc
+++ b/glom/mode_data/box_data.cc
@@ -30,6 +30,7 @@
#include <glom/application.h>
#include <algorithm> //For std::find()
#include <libglom/libglom_config.h>
+#include <iostream>
#include <glibmm/i18n.h>
#ifdef GLOM_ENABLE_MAEMO
@@ -380,7 +381,7 @@ void Box_Data::execute_button_script(const sharedptr<const LayoutItem_Button>& l
//Allow this UI to respond to UI change requests from the Python code:
AppPythonUICallbacks callbacks;
- Glib::ustring error_message; //TODO: Check this.
+ Glib::ustring error_message;
glom_execute_python_function_implementation(layout_item->get_script(),
field_values, //TODO: Maybe use the field's type here.
get_document(),
@@ -391,6 +392,11 @@ void Box_Data::execute_button_script(const sharedptr<const LayoutItem_Button>& l
#ifndef GLIBMM_EXCEPTIONS_ENABLED
}
#endif // !GLIBMM_EXCEPTIONS_ENABLED
+
+ if(!error_message.empty())
+ {
+ std::cerr << "Python Error: " << error_message << std::endl;
+ }
}
} //namespace Glom
diff --git a/glom/mode_design/dialog_database_preferences.cc b/glom/mode_design/dialog_database_preferences.cc
index a724840..6696534 100644
--- a/glom/mode_design/dialog_database_preferences.cc
+++ b/glom/mode_design/dialog_database_preferences.cc
@@ -282,6 +282,11 @@ void Dialog_Database_Preferences::on_button_test_script()
sharedconnection->get_gda_connection(),
callbacks,
error_message);
+
+ if(!error_message.empty())
+ {
+ std::cerr << "Python Error: " << error_message << std::endl;
+ }
}
diff --git a/tests/test_python_execute_script.cc b/tests/test_python_execute_script.cc
index a51554d..125c8ae 100644
--- a/tests/test_python_execute_script.cc
+++ b/tests/test_python_execute_script.cc
@@ -94,6 +94,11 @@ int main()
return EXIT_FAILURE;
}
+ if(!error_message.empty())
+ {
+ std::cerr << "Python Error: " << error_message << std::endl;
+ }
+
g_assert(error_message.empty());
//Check that the callbacks received the expected values:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]