[Mpuls-commits] r5464 - base/trunk/mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Oct 13 15:39:44 CEST 2011
Author: bh
Date: 2011-10-13 15:39:42 +0200 (Thu, 13 Oct 2011)
New Revision: 5464
Modified:
base/trunk/mpulsweb/lib/validators.py
Log:
Fix formatting.
Modified: base/trunk/mpulsweb/lib/validators.py
===================================================================
--- base/trunk/mpulsweb/lib/validators.py 2011-10-13 08:09:04 UTC (rev 5463)
+++ base/trunk/mpulsweb/lib/validators.py 2011-10-13 13:39:42 UTC (rev 5464)
@@ -14,7 +14,7 @@
from mpulsweb.lib.translation import _
from mpulsweb.lib.db import db
-from mpulsweb.lib.helpers import format_date
+from mpulsweb.lib.helpers import format_date
from mpulsweb.lib.base import session
@@ -35,6 +35,7 @@
allow_extra_fields = True
filter_extra_fields = False
+
class KeineAngabe(formencode.validators.FancyValidator):
messages = {
@@ -49,6 +50,7 @@
raise formencode.Invalid(self.message("invalid", state),
value, state)
+
class FileNotEmptyCheck(formencode.validators.FancyValidator):
"""Checks if the filename-field of the provided file-dict is empty.
@@ -113,7 +115,7 @@
ref = ''
file = field_dict[self.field_names[0]]
-
+
# if user gives a userdefined name for the file take this to check if
# the file is already existent. Else take filename from file
name = field_dict[self.field_names[1]]
@@ -170,7 +172,7 @@
"""
field_names = None
- validate_partial_form = False # do not run is a prior test failed
+ validate_partial_form = False # do not run is a prior test failed
__unpackargs__ = ('*', 'field_names')
messages = {
@@ -195,7 +197,7 @@
# german format
for key, value in dict.iteritems():
if isinstance(value, datetime.date):
- value = format_date(value)
+ value = format_date(value)
dict[key] = value
return dict
@@ -221,8 +223,8 @@
error_list.sort()
error_message = '<br>\n'.join(['%s: %s' % (name, value)
for name, value in error_list])
- raise formencode.Invalid(error_message, self.conv_dates(field_dict), state,
- error_dict=errors)
+ raise formencode.Invalid(error_message, self.conv_dates(field_dict),
+ state, error_dict=errors)
class MyDateConverter(DateConverter):
@@ -258,7 +260,7 @@
"""
field_names = None
- validate_partial_form = False # do not run is a prior test failed
+ validate_partial_form = False # do not run is a prior test failed
__unpackargs__ = ('*', 'field_names')
days = None
@@ -278,7 +280,7 @@
# german format
for key, value in dict.iteritems():
if isinstance(value, datetime.date):
- value = format_date(value)
+ value = format_date(value)
dict[key] = value
return dict
@@ -297,15 +299,17 @@
td = end - begin
if self.days:
if td.days > self.days:
- errors[self.field_names[0]] = self.message('toomuchdays', state, value=self.days)
- errors[self.field_names[1]] = self.message('toomuchdays', state, value=self.days)
+ errors[self.field_names[0]] = self.message('toomuchdays', state,
+ value=self.days)
+ errors[self.field_names[1]] = self.message('toomuchdays', state,
+ value=self.days)
if errors:
error_list = errors.items()
error_list.sort()
error_message = '<br>\n'.join(['%s: %s' % (name, value)
for name, value in error_list])
- raise formencode.Invalid(error_message, self.conv_dates(field_dict), state,
- error_dict=errors)
+ raise formencode.Invalid(error_message, self.conv_dates(field_dict),
+ state, error_dict=errors)
@@ -334,6 +338,7 @@
raise formencode.Invalid(self.message("invalid_date", state),
value, state)
+
class TimeCheck(formencode.validators.FancyValidator):
valid_date = re.compile(r'^[0-9]{1,2}:[0-9]{1,2}$')
@@ -583,14 +588,16 @@
class EditSettingsForm(BaseFormValidator):
anon_transfer = String(if_missing='off')
- max_speicherdauer = MaxMinInt(min=g.mpuls_config.get('case', 'remindermindays'),
- max=g.mpuls_config.get('case', 'remindermaxdays'),
+ max_speicherdauer = MaxMinInt(min=g.mpuls_config.get('case',
+ 'remindermindays'),
+ max=g.mpuls_config.get('case',
+ 'remindermaxdays'),
not_empty=True)
class NewPasswordForm(BaseFormValidator):
- passwd = SecurePassword()
+ passwd = SecurePassword()
passwd2 = String(min=1)
chained_validators = [FieldsMatch('passwd', 'passwd2')]
@@ -680,6 +687,7 @@
class SearchCaseForm(BaseFormValidator):
+
state = ForEach(Int(), convert_to_list=True)
own = Int(if_missing=0)
standin = Int(if_missing=0)
@@ -689,9 +697,12 @@
edate = DateCheck(if_missing=None)
gender = Int(if_missing=-2)
+
class EvaluationSearchCaseForm(SearchCaseForm):
+
federal_state = ForEach(Int(), convert_to_list=True)
+
class BundleActionForm(BaseFormValidator):
filter_extra_fields = True
@@ -704,7 +715,8 @@
'restore',
'standin', 'transfer',
'exportXML', 'exportCSV', 'exportXLS',
- 'formletter:1', 'formletter:2', 'formletter:3','formletter:4', 'formletter:5',
+ 'formletter:1', 'formletter:2', 'formletter:3',
+ 'formletter:4', 'formletter:5',
'evaluate']))
case_id = ForEach(Int(), convert_to_list=True)
all_ids = Wrapper(to_python=lambda s: [int(item) for item in s.split()])
@@ -736,7 +748,9 @@
user_id = Int()
case_id = ForEach(Int())
+
class NewCaseForm(BaseFormValidator):
+
statement_signed = Bool(if_missing=False)
More information about the Mpuls-commits
mailing list