minor pylint cleanup
[mevemon] / package / src / validation.py
index cf37fd7..76cfb9e 100644 (file)
@@ -1,6 +1,12 @@
+""" This module contains all our input validation functions """
+
+KEY_SIZE = 64
 
 class ValidationError(StandardError):
+    """ Exception that is raised if input validation fails
+    """
     def __init__(self, message):
+        StandardError.__init__(self)
         self.message = message
 
     def __str__(self):
@@ -8,30 +14,22 @@ class ValidationError(StandardError):
 
 
 
-def api_key(api_key):
-    """
-    validates an EVE api key. throws ValidationError exception if the
-    format is invalid.
+def validate_api_key(api_key):
+    """ Validates an EVE api key. throws ValidationError exception if the
+        format is invalid.
     """
-    KEY_SIZE = 64 
-
     #TODO: anything else we can do to validate the api key?
     
     if len(api_key) != KEY_SIZE:
         raise ValidationError("API Key must be %s characters" % KEY_SIZE)
     elif not api_key.isalnum():
-        raise ValidationError("API Key must only contain alphanumeric characters")
-    # apparently the api key CAN contain lower case characters...
-    #elif not api_key.isupper():
-    #    raise ValidationError("API Key must only contain upper-case characters")
-
-    return True
+        raise ValidationError("API Key must only contain alphanumeric " +\
+                              "characters")
 
 
-def uid(uid):
-    """
-    validates an EVE Online uid, throws ValidationError exception if the
-    format is invalid.
+def validate_uid(uid):
+    """ Validates an EVE Online uid, throws ValidationError exception if the
+        format is invalid.
     """
     #TODO: anything else we can do to validate the uid?