[Mpuls-commits] r5940 - base/trunk/mpulsweb/model
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Fri Apr 20 15:56:18 CEST 2012
Author: bricks
Date: 2012-04-20 15:56:18 +0200 (Fri, 20 Apr 2012)
New Revision: 5940
Modified:
base/trunk/mpulsweb/model/document.py
Log:
Check if all necessary anlage fields are present
If not raise a specific error to the user what's going wrong here.
Improvement for mpuls/issue3042 (mpuls_S: hs-neu-ulm.de: Bewerbungsassitent: Import schl?\195?\164gt fehl)
Modified: base/trunk/mpulsweb/model/document.py
===================================================================
--- base/trunk/mpulsweb/model/document.py 2012-04-20 13:06:14 UTC (rev 5939)
+++ base/trunk/mpulsweb/model/document.py 2012-04-20 13:56:18 UTC (rev 5940)
@@ -414,7 +414,12 @@
def import_document(cursor, case_id, document):
name = document.get_leaf("anlage-name")
mime = document.get_leaf("anlage-mime")
- content = base64.b64decode(document.get_leaf("anlage-daten"))
+ data = document.get_leaf("anlage-daten")
+ if name is None or mime is None or data is None:
+ raise DocumentException(_("The document seems to be corrupted. Invalid "
+ "anlage in document. Missing fields "
+ "anlage-name, anlage-mime or anlage-daten."))
+ content = base64.b64decode(data)
description = document.get_leaf("anlage-beschreibung")
insert_date = document.get_leaf("anlage-datum")
create_document_with_cursor(cursor, name, content, mime, case_id, None,
More information about the Mpuls-commits
mailing list