In a view you can only call functions defined in this view or a one being extended/included: http://web2py.com/books/default/chapter/29/5#Functions-in-views
More complex data processing should be done in the controller. Views should just present the data. Make the form transformation in the controller and pass the result to the view along with the form. def index(): form = SQLFORM(...) something = encadrement(form) return dict(form=form, something=something)

