[Mpuls-commits] r1001 - wasko/branches/2.0/waskaweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Jan 29 10:11:31 CET 2010
Author: torsten
Date: 2010-01-29 10:11:29 +0100 (Fri, 29 Jan 2010)
New Revision: 1001
Modified:
wasko/branches/2.0/waskaweb/controllers/caselifetime.py
Log:
* waskaweb/controllers/caselifetime.py
(CaselifetimeController.extraTimeAction): Added extra time now seems
to work again, but no time is actually inserted into database because
data can not be saved with libformed from within the caselifetime
controller. Saving is currently commented out
* waskaweb/controllers/caselifetime.py (_set_data): New. Save data
form using libformed. Saveing do not work yet correctly.
Modified: wasko/branches/2.0/waskaweb/controllers/caselifetime.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/caselifetime.py 2010-01-28 18:46:02 UTC (rev 1000)
+++ wasko/branches/2.0/waskaweb/controllers/caselifetime.py 2010-01-29 09:11:29 UTC (rev 1001)
@@ -214,6 +214,11 @@
return extractor
+def _set_data(it, data, case_id, do_write=True):
+ # FIXME: Setting data in instance tree seems not to work in this form.
+ # check implementation
+ it.setData(data)
+
def _get_value(it, id, case_id):
real_id = "%s:%s" % (id, case_id)
item = it.getItem(real_id)
@@ -372,7 +377,13 @@
return self.index(session['case'].id)
def extraTimeAction(self):
- checkcase()
+
+ factory = InstanceFactory(g.formedTree, PostgresDBInterface())
+ it = factory.loadInstanceTreeByIdentifier(session['case'].id)
+ case_id = it.getRootNode().getIdentifier()
+ S = _set_data
+ checkcase(it, case_id)
+
form_result = {}
form_errors = {}
@@ -382,14 +393,17 @@
validator = ExtraTimeFormValidator2()
try:
+ # 1. Check. Formencode check general format of date and if value is
+ # present
form_result = validator.to_python(request.params)
- # Pflichtfeldangaben scheinen ok -> setzen der Daten
try:
- c.casedata.setData(form_result)
+ # Save method will also do semantic check (dates or in
+ # chronology correct order)
+ #S(it, form_result, case_id)
create_logbook(header='Verlängerung des Integrationsprozess',
text=('Für den Fall wurde eine Verlängerung'
' des Integrationsprozess dokumentiert.'))
- return self.index()
+ return self.index(session['case'].id)
except DataSaveException, err:
form_result_1, form_errors = err.toErrorDicts()
except formencode.Invalid, error:
@@ -599,7 +613,13 @@
return render('/caselifetime/overview.mako')
def renewAction(self):
- checkcase()
+
+ factory = InstanceFactory(g.formedTree, PostgresDBInterface())
+ it = factory.loadInstanceTreeByIdentifier(session['case'].id)
+ case_id = it.getRootNode().getIdentifier()
+ S = _set_data
+ checkcase(it, case_id)
+
validator = RenewFormValidator()
form_result = {}
form_errors = {}
@@ -608,21 +628,21 @@
form_result = validator.to_python(request.params)
session['lifetimeparams'] = form_result
session.save()
- try:
- c.casedata.setData(form_result, do_write = False)
- if form_result.get('cm_neuauf_genehm') == '1':
- return self.renew_ok(0)
- else:
- return self.renew_notok(session['case'].id)
- except DataSaveException, err:
- form_result_1, form_errors = err.toErrorDicts()
+ #try:
+ # S(it, form_result, case_id, do_write = False)
+ # if form_result.get('cm_neuauf_genehm') == '1':
+ # return self.renew_ok(0)
+ # else:
+ # return self.renew_notok(session['case'].id)
+ #except DataSaveException, err:
+ # form_result_1, form_errors = err.toErrorDicts()
except formencode.Invalid, error:
- #print error
form_result = error.value
form_errors = error.error_dict or {}
c.form_result = form_result
c.form_errors = form_errors
+ #return self.index(session['case'].id)
return render('/caselifetime/overview.mako')
More information about the Mpuls-commits
mailing list