示例#1
0
 def _clean_epsilon_format(self, value):
     if value.startswith('0'):
         return value
     try:
         value = self._strip_decimals(is_float(value))
     except Exception:
         pass
     return value
示例#2
0
 def validate(self, latitude, longitude):
     latitude = latitude.strip(u'\u200e')
     longitude = longitude.strip(u'\u200e')
     latitude = latitude.encode('ascii')
     longitude = longitude.encode('ascii')
     try:
         lat = is_float(latitude,
                        min=ConstraintAttributes.MIN_LAT,
                        max=ConstraintAttributes.MAX_LAT)
     except VdtTypeError:
         raise LatitudeNotFloat(latitude)
     except VdtValueError:
         raise LatitudeNotInRange(latitude)
     try:
         long = is_float(longitude,
                         min=ConstraintAttributes.MIN_LONG,
                         max=ConstraintAttributes.MAX_LONG)
     except VdtTypeError:
         raise LongitudeNotFloat(longitude)
     except VdtValueError:
         raise LongitudeNotInRange(longitude)
     return lat, long
示例#3
0
 def validate(self, value):
     return is_float(value, min=self.min, max=self.max)