[python-geojson] 01/06: Imported Upstream version 1.2.1
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Sat Jun 27 12:50:52 UTC 2015
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository python-geojson.
commit 78d2bb18a1c27d3c4fc8a8af5ab2e2c71c220b76
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Sat Jun 27 14:42:52 2015 +0200
Imported Upstream version 1.2.1
---
CHANGELOG.rst | 7 +++++++
geojson/geometry.py | 9 ++++++++-
setup.py | 2 +-
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 4f1b9b1..58d550a 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,6 +1,13 @@
Changes
=======
+1.2.1 (2015-06-25)
+------------------
+
+- Encode long types correctly with Python 2.x
+
+ - https://github.com/frewsxcv/python-geojson/pull/57
+
1.2.0 (2015-06-19)
------------------
diff --git a/geojson/geometry.py b/geojson/geometry.py
index 30facc3..006cc80 100644
--- a/geojson/geometry.py
+++ b/geojson/geometry.py
@@ -1,3 +1,4 @@
+import sys
from decimal import Decimal
from geojson.base import GeoJSON
@@ -8,6 +9,12 @@ class Geometry(GeoJSON):
Represents an abstract base class for a WGS84 geometry.
"""
+ if sys.version_info[0] == 3:
+ # Python 3.x has no long type
+ __JSON_compliant_types = (float, int, Decimal)
+ else:
+ __JSON_compliant_types = (float, int, Decimal, long) # noqa
+
def __init__(self, coordinates=None, crs=None, **extra):
"""
Initialises a Geometry object.
@@ -29,7 +36,7 @@ class Geometry(GeoJSON):
for coord in coords:
if isinstance(coord, (list, tuple)):
cls.clean_coordinates(coord)
- elif not isinstance(coord, (float, int, Decimal)):
+ elif not isinstance(coord, cls.__JSON_compliant_types):
raise ValueError("%r is not JSON compliant number" % coord)
diff --git a/setup.py b/setup.py
index 031562a..e9dc069 100644
--- a/setup.py
+++ b/setup.py
@@ -30,7 +30,7 @@ import multiprocessing # NOQA
setup(
name="geojson",
- version="1.2.0",
+ version="1.2.1",
description="Python bindings and utilities for GeoJSON",
license="BSD",
keywords="gis geography json",
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/python-geojson.git
More information about the Pkg-grass-devel
mailing list