33from odin .validators import EMPTY_VALUES
44from .datatypes import latitude , longitude , latlng , point
55
6- __all__ = (' LatitudeField' , ' LongitudeField' , ' LatLngField' , ' PointField' )
6+ __all__ = (" LatitudeField" , " LongitudeField" , " LatLngField" , " PointField" )
77
88
99class LatitudeField (ScalarField ):
1010 """
1111 Field that contains a latitude value.
1212 """
13+
1314 default_error_messages = {
14- ' invalid' : "'%s' value must be a latitude." ,
15+ " invalid" : "'%s' value must be a latitude." ,
1516 }
1617 data_type_name = "Latitude"
1718
@@ -21,16 +22,17 @@ def to_python(self, value):
2122 try :
2223 return latitude (value )
2324 except (ValueError , TypeError ):
24- msg = self .error_messages [' invalid' ] % value
25+ msg = self .error_messages [" invalid" ] % value
2526 raise exceptions .ValidationError (msg )
2627
2728
2829class LongitudeField (ScalarField ):
2930 """
3031 Field that contains a longitude value.
3132 """
33+
3234 default_error_messages = {
33- ' invalid' : "'%s' value must be a longitude." ,
35+ " invalid" : "'%s' value must be a longitude." ,
3436 }
3537 data_type_name = "Longitude"
3638
@@ -40,16 +42,17 @@ def to_python(self, value):
4042 try :
4143 return longitude (value )
4244 except (ValueError , TypeError ):
43- msg = self .error_messages [' invalid' ] % value
45+ msg = self .error_messages [" invalid" ] % value
4446 raise exceptions .ValidationError (msg )
4547
4648
4749class LatLngField (Field ):
4850 """
4951 Field that contains a lat/long pair.
5052 """
53+
5154 default_error_messages = {
52- ' invalid' : "'%s' value must be a (latitude, longitude)." ,
55+ " invalid" : "'%s' value must be a (latitude, longitude)." ,
5356 }
5457 data_type_name = "LatLng"
5558
@@ -59,16 +62,17 @@ def to_python(self, value):
5962 try :
6063 return latlng (value )
6164 except (ValueError , TypeError ):
62- msg = self .error_messages [' invalid' ] % value
65+ msg = self .error_messages [" invalid" ] % value
6366 raise exceptions .ValidationError (msg )
6467
6568
6669class PointField (Field ):
6770 """
6871 Field that contains a point in cartesian space. This can be either 2D (on a plain) or 3D (includes a z-axis).
6972 """
73+
7074 default_error_messages = {
71- ' invalid' : "'%s' value must be a point in 2D or 3D cartesian space." ,
75+ " invalid" : "'%s' value must be a point in 2D or 3D cartesian space." ,
7276 }
7377 data_type_name = "Point"
7478
@@ -78,5 +82,5 @@ def to_python(self, value):
7882 try :
7983 return point (value )
8084 except (ValueError , TypeError ):
81- msg = self .error_messages [' invalid' ] % value
85+ msg = self .error_messages [" invalid" ] % value
8286 raise exceptions .ValidationError (msg )
0 commit comments