[Mpuls-commits] r5098 - in jmd/trunk: . jmdstrukturweb/controllers jmdstrukturweb/lib jmdstrukturweb/templates/casemanagement
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Jun 9 14:48:52 CEST 2011
Author: roland
Date: 2011-06-09 14:48:51 +0200 (Thu, 09 Jun 2011)
New Revision: 5098
Modified:
jmd/trunk/ChangeLog
jmd/trunk/jmdstrukturweb/controllers/case.py
jmd/trunk/jmdstrukturweb/lib/validators.py
jmd/trunk/jmdstrukturweb/templates/casemanagement/new.mako
Log:
issue2194: use a custom validator when creating new structure cases
Modified: jmd/trunk/ChangeLog
===================================================================
--- jmd/trunk/ChangeLog 2011-06-09 10:21:37 UTC (rev 5097)
+++ jmd/trunk/ChangeLog 2011-06-09 12:48:51 UTC (rev 5098)
@@ -1,5 +1,12 @@
2011-06-09 Roland Geider <roland.geider at intevation.de>
+ * jmdstrukturweb/controllers/case.py,
+ jmdstrukturweb/lib/validators.py,
+ jmdstrukturweb/templates/casemanagement/new.mako: issue2194: use
+ a custom validator when creating new structure cases
+
+2011-06-09 Roland Geider <roland.geider at intevation.de>
+
* jmdstrukturweb/public/xml/eval_struktur.xml: issue2201: write new
evaluations
Modified: jmd/trunk/jmdstrukturweb/controllers/case.py
===================================================================
--- jmd/trunk/jmdstrukturweb/controllers/case.py 2011-06-09 10:21:37 UTC (rev 5097)
+++ jmd/trunk/jmdstrukturweb/controllers/case.py 2011-06-09 12:48:51 UTC (rev 5098)
@@ -118,43 +118,8 @@
c.url_no = h.url_for(controller='/case_overview')
return render('/casemanagement/dialogs/confirm_delete.mako')
- @checkRole('cm_ka')
- def newAction(self):
- # TODO: Use htmlfill here!
- session_case = SessionCase()
- session_case.setData(request.params)
+ def _get_validator(self):
+ '''Set specific validator'''
+ return NewCaseForm()
- session['case'] = session_case
- session.save()
-
- # Do we want to print the statement?
- if request.params.has_key('print'):
- c.print_version = 1
- statement = PrivacyStatement(session_case, Agency())
- c.content = statement.fillout()
- return render('privacy/default_statement.mako')
-
- # Or do we want to store the new case?
- elif request.params.has_key('save'):
- validator = NewCaseForm()
- try:
- form_result = validator.to_python(request.params)
- # 1. Create a new case
- data = convert2dic(form_result)
- log.debug(data)
- case = g.case_factory.createNew(data=data)
- statement = case.getPrivacyStatement()
-
- # 2. Do we want to sign the statement?
- if form_result.get('statement_signed'):
- statement.sign()
-
- except formencode.Invalid, error:
- log.debug("Invalid form data: %r", error)
- c.form_result = error.value
- c.form_errors = error.error_dict or {}
- return render('/casemanagement/new.mako')
-
- return self.select(str(case.id))
-
# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
Modified: jmd/trunk/jmdstrukturweb/lib/validators.py
===================================================================
--- jmd/trunk/jmdstrukturweb/lib/validators.py 2011-06-09 10:21:37 UTC (rev 5097)
+++ jmd/trunk/jmdstrukturweb/lib/validators.py 2011-06-09 12:48:51 UTC (rev 5098)
@@ -24,11 +24,11 @@
# European Social Fund resources.
from formencode.validators import Bool, String
-from mpulsweb.lib.validators import BaseFormValidator, MyDateConverter
+from mpulsweb.lib.validators import BaseFormValidator, MyDateConverter, DateCheck
class NewCaseForm(BaseFormValidator):
- datum_begin_zeitraum = String()
- datum_ende_zeitraum = String()
+ datum_begin_zeitraum = DateCheck()
+ datum_ende_zeitraum = DateCheck()
# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8
Modified: jmd/trunk/jmdstrukturweb/templates/casemanagement/new.mako
===================================================================
--- jmd/trunk/jmdstrukturweb/templates/casemanagement/new.mako 2011-06-09 10:21:37 UTC (rev 5097)
+++ jmd/trunk/jmdstrukturweb/templates/casemanagement/new.mako 2011-06-09 12:48:51 UTC (rev 5098)
@@ -25,6 +25,7 @@
name="datum_begin_zeitraum" id="datum_begin_zeitraum"
value="">
</td>
+ <td class=""><span class="error"><form:error name="datum_begin_zeitraum"></span></td>
</tr>
<tr>
<td class="label">
@@ -35,6 +36,7 @@
name="datum_ende_zeitraum" id="datum_ende_zeitraum"
value="">
</td>
+ <td class=""><span class="error"><form:error name="datum_ende_zeitraum"></span></td>
</tr>
</table>
</fieldset>
More information about the Mpuls-commits
mailing list