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

# 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():
   # An error has occurred.  Set the status to 'failure' 
   # (the default initial status is 'success')
   state.setStatus('failure')

# No errors.  Always make sure to return the ControllerState object
return state