1 """ This module contains all our input validation functions """
5 class ValidationError(StandardError):
6 """ Exception that is raised if input validation fails
8 def __init__(self, message):
9 StandardError.__init__(self)
10 self.message = message
13 return repr(self.message)
17 def validate_api_key(api_key):
18 """ Validates an EVE api key. throws ValidationError exception if the
21 #TODO: anything else we can do to validate the api key?
23 if len(api_key) != KEY_SIZE:
24 raise ValidationError("API Key must be %s characters" % KEY_SIZE)
25 elif not api_key.isalnum():
26 raise ValidationError("API Key must only contain alphanumeric " +\
30 def validate_uid(uid):
31 """ Validates an EVE Online uid, throws ValidationError exception if the
34 #TODO: anything else we can do to validate the uid?
37 raise ValidationError("UID must be a number")
39 raise ValidationError("Missing UID")