Dear fellow w2peers, I would like to make use of the db validators through an sqlform, but without having user interaction. Code speaks best:
logs = [ ] for line in file('my_input_file.txt').readlines(): name,age = line.split(',') form = SQLFORM(db.person) request.vars.name = name request.vars.age = age if form.accepts(request.vars, session, onvalidate=validate_person): logs.append('record updated') elif form.errors: logs.append('errors in form') else: logs.append("I keep ending up here each time I call this controller") return dict(logs='</br>'.join(logs)) I also tried the following and got the same result as above: ... form.vars.name = name form.vars.age = age if form.accepts(form.vars, ... My wild guess is that SQLFORM does not allow this because of security concerns: the form's hidden fields do not match the session. Is there a way around this? My requirement is to be able to process the input file and populate/ update the persons table accordingly while validating the input parameters with the table's validators and the form's onvalidate method. All of this is done in one go from a single controller. Any help/recommendations will be greatly appreciated. Thanks, Stoyan.