################################################################################
# Example validator code

# Set the state status (unnecessary here, since the default status is 'success')
state.setStatus = 'success'

# validate your variables here
n = context.REQUEST.get('n', None)
if not n:
   state.setError('n', 'Please enter a value for n')

if state.getErrors():
   return state.set(status='failure', portal_status_message='Please correct the errors shown')

# Make sure to return the ControllerState object
return state