Your my_validator function iterates through the whole table.  This is OK 
when you have a few records,  but very inefficient if you have 
thousands/millions.  Why not simply query the table?  Something like this...

def my_validator(form):
    if db((db.lecture.id == form.vars.id) & (db.lecture.lecture_time == form
.vars.lecture_time)
         ).count() >0:
        form.errors.lecturer=SPAN("Record already exists", _style="font-weight: 
bold;")

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a703262b-14ee-4e2a-84e3-274a97fb2024o%40googlegroups.com.

Reply via email to