Permalink
Browse files

Removed quotations from the error messages when a scalar type is used…

… in the format string.
  • Loading branch information...
1 parent 442b3e9 commit ba065d283ebd1715b459e72b0e6866744aac342c dsmith committed Jul 1, 2010
Showing with 12 additions and 6 deletions.
  1. +6 −0 debian/changelog
  2. +5 −5 geojson/__init__.py
  3. +1 −1 setup.py
View
@@ -1,3 +1,9 @@
+python-simplegeo-geojson (0.1.4) unstable; urgency=low
+
+ * Removed quotations from the error messages when a scalar type is used in the format string.
+
+ -- Derek Smith <derek@simplegeo.com> Thu, 1 July 2010 05:36:00 -0700
+
python-simplegeo-geojson (0.1.3) unstable; urgency=low
* Error messages should not print out the objects but rather the value
View
@@ -183,26 +183,26 @@ class PositionField(Field):
def validate(self, value):
super(PositionField, self).validate(value)
if not hasattr(value, '__len__') or len(value) < 2:
- raise ValidationError('Value %s are not valid coordinates' % self.string_for_value(value))
+ raise ValidationError('Value %s are not valid coordinates' % self.proper_value(value))
try:
lonlat = [float(i) for i in value]
if lonlat[1] < -90 or lonlat[1] > 90:
raise ValidationError('Latitude must be between -90 and 90.')
if lonlat[0] < -180 or lonlat[0] > 180:
raise ValidationError('Longitude must be between -180 and 180.')
except (TypeError, ValueError):
- raise ValidationError('Value %s are not valid coordinates' % self.string_for_value(value))
+ raise ValidationError('Value %s are not valid coordinates' % self.proper_value(value))
- def string_for_value(self, value):
+ def proper_value(self, value):
elements = None
if value.__class__ is list:
- elements = [self.string_for_value(element) for element in value]
+ elements = [self.proper_value(element) for element in value]
elif value.__class__ is Decimal:
elements = float(value)
else:
elements = value
- return str(elements)
+ return elements
class LinearRingField(ListField):
View
@@ -4,7 +4,7 @@
#
from setuptools import setup, find_packages
setup(name="simplegeo-geojson",
- version='0.1.3',
+ version='0.1.4',
description="A geojson library.",
url="http://github.com/simplegeo/python-geojson",
packages=find_packages(),

0 comments on commit ba065d2

Please sign in to comment.