Massimo, > Why isn't the problem solved by the validator that I posted?
In my model the openinghours table reads like: db.define_table('openinghours', Field ('company',db.company,default='',notnull=True,ondelete='CASCADE', writable=False, readable=False), Field('day',db.day,default='',notnull=True,ondelete='RESTRICT'), Field('from_tijd',type='time',default='',notnull=True), Field('to_tijd',type='time',default='',notnull=True), migrate='openinghours.table') ... db.openinghours.from_time.requires=IS_TIME(error_message='should be UU:MM!') db.openinghours.from_time.widget=timeplain db.openinghours.from_time.requires=is_less_than(request.vars.to_time) db.openinghours.to_time.requires=IS_TIME(error_message='should be UU:MM!') db.openinghours.to_time.widget=timeplain In the less_than_class I changed the following line, because of the format of the opening hours: other=datetime.datetime.strptime(self.value,'%H:%M') When I expose the functions that create or update opening hours, I get an error ticket: Traceback (most recent call last): File "/Library/Python/2.5/site-packages/web2py/gluon/restricted.py", line 184, in restricted exec ccode in environment File "/Library/Python/2.5/site-packages/web2py/applications/cms/ controllers/services.py", line 224, in <module> File "/Library/Python/2.5/site-packages/web2py/gluon/globals.py", line 103, in <lambda> self._caller = lambda f: f() File "/Library/Python/2.5/site-packages/web2py/gluon/tools.py", line 1644, in f return action(*a, **b) File "/Library/Python/2.5/site-packages/web2py/applications/cms/ controllers/services.py", line 34, in update_openinghour form=update_form (db.openingstijd,record,'crud_openinghour','Openingstijd gewijzigd',True) File "/Library/Python/2.5/site-packages/web2py/applications/cms/ models/db.py", line 703, in update_form form=crud.update(table,record,next=(URL (r=request,f=next)),message=message,deletable=deletable) File "/Library/Python/2.5/site-packages/web2py/gluon/tools.py", line 2040, in update keepvalues=self.settings.keepvalues): File "/Library/Python/2.5/site-packages/web2py/gluon/sqlhtml.py", line 765, in accepts onvalidation, File "/Library/Python/2.5/site-packages/web2py/gluon/html.py", line 1269, in accepts status = self._traverse(status) File "/Library/Python/2.5/site-packages/web2py/gluon/html.py", line 453, in _traverse newstatus = c._traverse(status) and newstatus File "/Library/Python/2.5/site-packages/web2py/gluon/html.py", line 453, in _traverse newstatus = c._traverse(status) and newstatus File "/Library/Python/2.5/site-packages/web2py/gluon/html.py", line 453, in _traverse newstatus = c._traverse(status) and newstatus File "/Library/Python/2.5/site-packages/web2py/gluon/html.py", line 453, in _traverse newstatus = c._traverse(status) and newstatus File "/Library/Python/2.5/site-packages/web2py/gluon/html.py", line 460, in _traverse newstatus = self._validate() File "/Library/Python/2.5/site-packages/web2py/gluon/html.py", line 1078, in _validate (value, errors) = validator(value) File "/Library/Python/2.5/site-packages/web2py/applications/cms/ models/db.py", line 28, in __call__ other=datetime.datetime.strptime(self.value,'%H:%M') TypeError: strptime() argument 1 must be string, not None I don't understand why argument 1 is None. > If you want to compare from_time with to_time then to_time should bot > be None unless you tell us how should the validation be performed in > this case. When the user enters from_time 10:00 and to_time 22:00 the form should be accepted, 10:00 < 22:00 is True When the user enters from_time 10.00 and to_time 02:00 the form should NOT be accepted. 10:00 < 02:00 is False. I hope this explanation of my problem helps you help me solve it. Annet. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.