[glom] Write Python tracebacks to stderr.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Write Python tracebacks to stderr.
- Date: Tue, 5 Apr 2011 13:32:40 +0000 (UTC)
commit a2dfd16c7d1ad389a47c4769b9bfc4a90fb592b2
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 | 7 ++++++-
glom/mode_design/dialog_database_preferences.cc | 5 +++++
tests/test_python_execute_script.cc | 5 +++++
5 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f27f41f..f5a10bf 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 7377145..c377a81 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -1281,6 +1281,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 edcb3cd..6e39aaa 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
@@ -373,7 +374,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(),
@@ -381,6 +382,10 @@ void Box_Data::execute_button_script(const sharedptr<const LayoutItem_Button>& l
sharedconnection->get_gda_connection(),
callbacks,
error_message);
+ 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 7d35f6c..c1ff40d 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]