# HG changeset patch # User Paul Boddie # Date 1245699916 -7200 # Node ID ae7bdbf61e32718b55f825d983d4ed2b09753e19 # Parent abdc1b4842cf9067f6999ac342a1c213f8cf732b Added some error handling to the questionnaire application. diff -r abdc1b4842cf -r ae7bdbf61e32 examples/Common/Questionnaire/Resources/question_template.xhtml --- a/examples/Common/Questionnaire/Resources/question_template.xhtml Sat Jun 20 00:26:12 2009 +0200 +++ b/examples/Common/Questionnaire/Resources/question_template.xhtml Mon Jun 22 21:45:16 2009 +0200 @@ -20,6 +20,8 @@

+

The file could not be loaded.

+

Or enter questions and possible responses below.

diff -r abdc1b4842cf -r ae7bdbf61e32 examples/Common/Questionnaire/__init__.py --- a/examples/Common/Questionnaire/__init__.py Sat Jun 20 00:26:12 2009 +0200 +++ b/examples/Common/Questionnaire/__init__.py Mon Jun 22 21:45:16 2009 +0200 @@ -86,11 +86,16 @@ if parameters.has_key("import"): importfile = parameters["importfile"][0] - try: - doc = libxml2dom.parse(importfile.stream) - form.set_document(doc) - except libxml2dom.LSException: - pass + + if hasattr(importfile, "stream"): + try: + doc = libxml2dom.parse(importfile.stream) + form.set_document(doc) + return # success + except libxml2dom.LSException: + pass + + questionnaire.documentElement.setAttribute("error", "true") def init_document(self, trans, form):