[Mpuls-commits] r469 - in wasko/trunk: . waskaweb/controllers waskaweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Apr 3 12:19:59 CEST 2009
Author: teichmann
Date: 2009-04-03 12:19:58 +0200 (Fri, 03 Apr 2009)
New Revision: 469
Modified:
wasko/trunk/ChangeLog.txt
wasko/trunk/waskaweb/controllers/case.py
wasko/trunk/waskaweb/model/casexml.py
Log:
Fixes for issue150, issue149 and issue162 (partly)
Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt 2009-04-03 08:56:00 UTC (rev 468)
+++ wasko/trunk/ChangeLog.txt 2009-04-03 10:19:58 UTC (rev 469)
@@ -1,5 +1,14 @@
2009-04-02 Sascha L. Teichmann <teichmann at intevation.de>
+ Fixes for issue150, issue149 and issue162 (partly)
+
+ * waskaweb/model/casexml.py: Only import the case if its
+ not 'schwebend-*'. Fixed XMLImportExceptions.
+
+ * waskaweb/controllers/case.py: Another tweak againt UEE.
+
+2009-04-02 Sascha L. Teichmann <teichmann at intevation.de>
+
Fix for issue137
* waskaweb/templates/caselifetime/overview.mako: extra mapping
Modified: wasko/trunk/waskaweb/controllers/case.py
===================================================================
--- wasko/trunk/waskaweb/controllers/case.py 2009-04-03 08:56:00 UTC (rev 468)
+++ wasko/trunk/waskaweb/controllers/case.py 2009-04-03 10:19:58 UTC (rev 469)
@@ -617,11 +617,9 @@
c.url_ok = h.url_for(controller="/case_overview")
return render('/casemanagement/dialogs/success_xml_import.mako')
except XMLImportException, err:
- traceback.print_exc(file = sys.stderr)
- c.error = err.errors
+ c.error = err.errors
c.failed_for = IMPORT_FAILED
- if type(err) == str: err = unicode(err, "UTF-8", "replace")
- c.failed_text = err
+ c.failed_text = err.desc
c.url_ok = "/case/importCase"
return render('/casemanagement/dialogs/failed_xml_import2.mako')
except:
Modified: wasko/trunk/waskaweb/model/casexml.py
===================================================================
--- wasko/trunk/waskaweb/model/casexml.py 2009-04-03 08:56:00 UTC (rev 468)
+++ wasko/trunk/waskaweb/model/casexml.py 2009-04-03 10:19:58 UTC (rev 469)
@@ -74,6 +74,13 @@
SQL_UPDATE_LOGBOOK = \
"""UPDATE ka_logbuch_tbl_view SET %s WHERE id = %d"""
+SQL_GET_STATUS = \
+"""SELECT s.status AS status FROM
+ master_tbl_view m INNER JOIN ka_status_tbl_view s
+ ON s.master_id = m.id
+ WHERE m.id = %(mid)s
+"""
+
VERSION = 2
DECODERS = {
@@ -98,6 +105,12 @@
if not row: return False
return row[0]
+def get_status(cur, mid):
+ cur.execute(SQL_GET_STATUS, { 'mid': mid })
+ row = cur.fetchone()
+ if not row: return None
+ return row[0]
+
def get_logbuch_ids_from_uuid(cur, uuid_id):
cur.execute(SQL_SELECT_IDS_FROM_LOGBOOK, { 'uuid_id': uuid_id })
return cur.fetchone()
@@ -113,9 +126,12 @@
class XMLImportException(Exception):
def __init__(self, desc, errors = None):
- Exception.__init__(self, desc)
+ self.desc = desc
self.errors = errors
+ def __str__(self):
+ return repr(self.desc)
+
class LogbookEntry(object):
def __init__(self, uuid = None):
@@ -401,11 +417,21 @@
if is_uuid_anonymized(self.cur, self.uuid):
raise XMLImportException(
- u"Die Fallakte wurde auf dem zentralen Server bereits anonymisiert. "
+ u"Die Fallakte wurde auf dem zentralen Server bereits anonymisiert. " \
u"Ein Import ist daher nicht mehr möglich.")
ds_id = get_id_for_uuid(self.cur, 'master', self.uuid)
if not ds_id is None:
+ # check status first
+ status = get_status(self.cur, ds_id)
+ if status == 4:
+ raise XMLImportException(
+ u"Die Akte ist auf dem zentralen Server zur Zeit " \
+ u"schwebend anonymisiert und daher nicht bearbeitbar.")
+ if status == 3:
+ raise XMLImportException(
+ u"Die Akte ist auf dem zentralen Server zur Zeit " \
+ u"schwebend gelöscht und daher nicht bearbeitbar.")
#print >> sys.stderr, "case %d already exists" % ds_id
self.cur.execute(SQL_SELECT_ALL_FROM_MASTER % { 'ds_id': ds_id })
row = self.cur.fetchone()
More information about the Mpuls-commits
mailing list