[Mpuls-commits] r328 - in wasko/trunk: . waskaweb/controllers waskaweb/model waskaweb/templates/casemanagement/dialogs
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Mar 4 17:09:42 CET 2009
Author: torsten
Date: 2009-03-04 17:09:40 +0100 (Wed, 04 Mar 2009)
New Revision: 328
Added:
wasko/trunk/waskaweb/templates/casemanagement/dialogs/failed_xml_import2.mako
Modified:
wasko/trunk/ChangeLog.txt
wasko/trunk/waskaweb/controllers/case.py
wasko/trunk/waskaweb/model/casexml.py
Log:
Added more detailed error dialog when importing xml
Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt 2009-03-04 13:36:00 UTC (rev 327)
+++ wasko/trunk/ChangeLog.txt 2009-03-04 16:09:40 UTC (rev 328)
@@ -3,6 +3,15 @@
* waskaweb/model/casexml.py: Raise XMLImportException when an
expected error occurs.
+ Created new error dialog for the xml import
+
+ * model/casexml.py,
+ controllers/case.py,
+ templates/casemanagement/dialogs/failed_xml_import2.mako: If where
+ are inconsistencys in the xml while importing the import will fail
+ and the user will see a detailed error message on which
+ inkonsistencys are in the case.
+
2009-03-04 Torsten Irlaender <torsten.irlaender at intevation.de>
Store full username in logboook instead of user id
Modified: wasko/trunk/waskaweb/controllers/case.py
===================================================================
--- wasko/trunk/waskaweb/controllers/case.py 2009-03-04 13:36:00 UTC (rev 327)
+++ wasko/trunk/waskaweb/controllers/case.py 2009-03-04 16:09:40 UTC (rev 328)
@@ -76,7 +76,7 @@
from waskaweb.lib.db import db
#from waskaweb.lib.xmlimport import importFromXML
-from waskaweb.model.casexml import import_xml
+from waskaweb.model.casexml import import_xml, XMLImportException
from waskaweb.controllers.appointment import DELETE_APPOINT_NOTIFICATION_SUCCESS, \
DELETE_APPOINT_NOTIFICATION_FAILED, \
@@ -463,6 +463,14 @@
c.success_text = IMPORT_XML_SUCCESS_TEXT
c.url_ok = h.url_for(controller="/case_overview")
return render('/casemanagement/dialogs/success_xml_import.mako')
+ except XMLImportException, err:
+ import traceback, sys
+ traceback.print_exc(file = sys.stderr)
+ c.error = err.errors
+ c.failed_for = IMPORTS_FAILED
+ c.failed_text = unicode(err)
+ c.url_ok = "/case/importCase"
+ return render('/casemanagement/dialogs/failed_xml_import2.mako')
except:
import traceback, sys
traceback.print_exc(file = sys.stderr)
Modified: wasko/trunk/waskaweb/model/casexml.py
===================================================================
--- wasko/trunk/waskaweb/model/casexml.py 2009-03-04 13:36:00 UTC (rev 327)
+++ wasko/trunk/waskaweb/model/casexml.py 2009-03-04 16:09:40 UTC (rev 328)
@@ -441,20 +441,21 @@
for rule in rules:
mark = rule.getMark()
if mark and mark.find("warning:") >= 0: continue
+ print rule.getAttribute('expr')
expr = rule.getExpr()
isNull, params = False, {}
n_okay = True
for dep in expr.getDependencies():
dep_v = get_data(dep)
- if dep_v is None: isNull = True; break
+ if dep != var and dep_v is None: isNull = True; break
params[dep] = dep_v
if not isNull:
params[var] = value
try: n_okay = expr.evaluate(params)
except: n_okay = False
if not n_okay:
- errors.append(rule.getDescription())
+ errors.append(rule.getValue())
okay = False
if okay:
changed[var] = value
Added: wasko/trunk/waskaweb/templates/casemanagement/dialogs/failed_xml_import2.mako
===================================================================
--- wasko/trunk/waskaweb/templates/casemanagement/dialogs/failed_xml_import2.mako 2009-03-04 13:36:00 UTC (rev 327)
+++ wasko/trunk/waskaweb/templates/casemanagement/dialogs/failed_xml_import2.mako 2009-03-04 16:09:40 UTC (rev 328)
@@ -0,0 +1,25 @@
+## -*- coding: utf-8 -*-
+<%! import waskaweb.lib.filters as F %>
+<%inherit file="/main.mako" />
+<%def name="buildNavipath()">
+ ${parent.buildNavipath()}
+ <li><a href="#">${_('cm_np_anonymize')}</a></li>
+</%def>
+<div class="dialog" />
+<h1><img src="/images/failure.png" alt="Fehler"/>${c.failed_for | F.NA, h}</h1>
+<p>${c.failed_text | F.NA, h}</p>
+% if c.error:
+<p>
+Es wurden folgende Probleme mit der Fallakte festgestellt:
+<ol>
+% for num,err in enumerate(c.error):
+ <li>
+ ${num+1}. ${err | F.NA, h}
+ </li>
+% endfor
+</ol>
+Bitte beheben Sie die genannten Probleme z.B. mit dem Offline-Klienten und starten Sie danach einen neuen Importversuch.
+</p>
+% endif
+<a class="button" href="${c.url_ok}">${_('dialog_header_confirm_option_ok')}</a>
+</div>
More information about the Mpuls-commits
mailing list