which version?
On Wednesday, 4 September 2013 13:49:29 UTC-5, Annet wrote:
>
> In a table definition I have these two fields:
>
> Field('startDate', label='Start datum * ', **isdate),
> Field('endDate', label='Eind datum', **isemptyorisdate),
>
> Since I have more of these fields I defined the following dicts
>
> isdate = dict(type='date', requires=IS_DATE(format='%d-%m-%Y',
> error_message='Formaat komt niet overeen met %d-%m-%Y'), represent=lambda
> v: v.strftime('%d/%m/%Y') if v else '')
> isemptyorisdate = dict(type='date',
> requires=IS_EMPTY_OR(IS_DATE(format='%d-%m-%Y', error_message='Formaat komt
> niet overeen met %d-%m-%Y')), represent=lambda v: v.strftime('%d/%m/%Y') if
> v else '')
>
> I have more of these dict validators which all work fine:
>
> istime = dict(type='time', requires=IS_TIME(error_message='Formaat komt
> niet overeen met HH:MM'), widget=timewidget, comment='Formaat HH:MM')
> isemptyoristime = dict(type='time',
> requires=IS_EMPTY_OR(IS_TIME(error_message='Formaat komt niet overeen met
> HH:MM')), widget=timewidget, comment='Formaat HH:MM')
>
>
> When I submit: http://127.0.0.1:8000/dbModel/appadmin/insert/db/eventList
>
> I get the following error:
>
>
> Traceback (most recent call last):
> File "/Users/annet/web2py/gluon/restricted.py", line 212, in restricted
> exec ccode in environment
> File "/Users/annet/web2py/applications/dbModel/controllers/appadmin.py"
> <http://127.0.0.1:8000/admin/default/edit/dbModel/controllers/appadmin.py>,
> line 615, in <module>
> File "/Users/annet/web2py/gluon/globals.py", line 194, in <lambda>
> self._caller = lambda f: f()
> File "/Users/annet/web2py/applications/dbModel/controllers/appadmin.py"
> <http://127.0.0.1:8000/admin/default/edit/dbModel/controllers/appadmin.py>,
> line 142, in insert
> if form.accepts(request.vars, session):
> File "/Users/annet/web2py/gluon/sqlhtml.py", line 1370, in accepts
> **kwargs
> File "/Users/annet/web2py/gluon/html.py", line 2010, in accepts
> status = self._traverse(status, hideerror)
> File "/Users/annet/web2py/gluon/html.py", line 846, in _traverse
> newstatus = c._traverse(status, hideerror) and newstatus
> File "/Users/annet/web2py/gluon/html.py", line 846, in _traverse
> newstatus = c._traverse(status, hideerror) and newstatus
> File "/Users/annet/web2py/gluon/html.py", line 846, in _traverse
> newstatus = c._traverse(status, hideerror) and newstatus
> File "/Users/annet/web2py/gluon/html.py", line 846, in _traverse
> newstatus = c._traverse(status, hideerror) and newstatus
> File "/Users/annet/web2py/gluon/html.py", line 853, in _traverse
> newstatus = self._validate()
> File "/Users/annet/web2py/gluon/html.py", line 1759, in _validate
> (value, errors) = validator(value)
> File "/Users/annet/web2py/gluon/validators.py", line 2695, in __call__
> return self.other(value)
> File "/Users/annet/web2py/gluon/validators.py", line 2269, in __call__
> return (ovalue, translate(self.error_message) % self.extremes)
> TypeError: %d format: a number is required, not dict
>
>
>
> Kind regards,
>
>
> Annet
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.