[Mpuls-commits] r5268 - waska/branches/waska3/waskaweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Aug 30 09:29:16 CEST 2011
Author: torsten
Date: 2011-08-30 09:29:16 +0200 (Tue, 30 Aug 2011)
New Revision: 5268
Modified:
waska/branches/waska3/waskaweb/controllers/case.py
Log:
Aktion zum Neuanlegen von F?\195?\164llen wird nun die aus der Basis verwendet.
Modified: waska/branches/waska3/waskaweb/controllers/case.py
===================================================================
--- waska/branches/waska3/waskaweb/controllers/case.py 2011-08-30 07:28:18 UTC (rev 5267)
+++ waska/branches/waska3/waskaweb/controllers/case.py 2011-08-30 07:29:16 UTC (rev 5268)
@@ -43,66 +43,10 @@
from mpulsweb.controllers.navigation import NavigationController
from mpulsweb.controllers.case import CaseController as MpulsCaseController
-from waskaweb.lib.validators import NewCaseForm
-
log = logging.getLogger(__name__)
class CaseController(MpulsCaseController):
- @checkRole('cm_ka')
- def newAction(self):
- # TODO: Use htmlfill here!
- session_case = SessionCase()
- session_case.setData(request.params)
-
- session['case'] = session_case
- session.save()
- agency = Agency()
-
- # 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)
- # Add fkz of the agency to the form_result
- form_result['fkz'] = agency.getFKZ()
- # 1. Create a new case
- case = g.case_factory.createNew(data=convert2dic({}))
- case._load_formed_instance_tree()
- # Set data
- data = {}
- for k in convert2dic(form_result).keys():
- try:
- item = case.formed_instance.getAllItemsForName(k)[0]
- id = ":".join(item.getIdentifier().split(':')[1:])
- data["%s:%s" % (k,id)] = form_result.get(k)
- except:
- # some values within the formresult can not be found in
- # instance tree. e.g "statement_signed"
- pass
- case.formed_instance.setData(data)
- case.formed_instance.commit()
-
- statement = case.getPrivacyStatement()
- # 3. 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))
-
def print_AidplanStatement(self, id):
# Call navigation controller which will trigger rendering the right
# formularpage. Content of the formularpage (c.formular) will be user
More information about the Mpuls-commits
mailing list