def register_validation(form):
 form_vars = form.vars
 mobile = form_vars.get('mobile')
 if mobile:
  import re
  regex = re.compile(single_phone_number_pattern)
  if (not regex.match(mobile)):
   form.errors.mobile = T('Invalid phone number')
 elif settings.get_auth_registration_mobile_phone_mandatory():
  form.errors.mobile = T('Phone number is required')
 home = form_vars.get('home')
 if home:
  import re
  regex = re.compile(single_phone_number_pattern)
  if (not regex.match(home)):
   form.errors.home = T('Invalid phone number')
 org = settings.get_auth_registration_organisation_id_default()
 if org:
  form_vars.organisation_id = org
 return

def register_validation ( form ) : form_vars = form . vars mobile = form_vars . get ( 'mobile' ) if mobile : import re regex = re . compile ( single_phone_number_pattern ) if ( not regex . match ( mobile ) ) : form . errors . mobile = T ( 'Invalid phone number' ) elif settings . get_auth_registration_mobile_phone_mandatory ( ) : form . errors . mobile = T ( 'Phone number is required' ) home = form_vars . get ( 'home' ) if home : import re regex = re . compile ( single_phone_number_pattern ) if ( not regex . match ( home ) ) : form . errors . home = T ( 'Invalid phone number' ) org = settings . get_auth_registration_organisation_id_default ( ) if org : form_vars . organisation_id = org return
validate the fields in registration form .