From d1d59722774f59d3ee9b935bfda9ff7e373b43c3 Mon Sep 17 00:00:00 2001 From: Ross Lawley Date: Thu, 26 Jun 2014 16:34:02 +0100 Subject: [PATCH] Removed support for old versions - Removing support for Django 1.4.x, pymongo 2.5.x, pymongo 2.6.x. - Removing support for Python < 2.6.6 --- .travis.yml | 34 +-------------------------------- docs/changelog.rst | 2 ++ mongoengine/base/document.py | 7 +------ mongoengine/python_support.py | 32 ------------------------------- mongoengine/queryset/visitor.py | 5 +++-- setup.py | 6 ++++-- 6 files changed, 11 insertions(+), 75 deletions(-) diff --git a/.travis.yml b/.travis.yml index c20e52af..40736165 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,44 +11,12 @@ python: env: - PYMONGO=dev DJANGO=1.6.5 - PYMONGO=dev DJANGO=1.5.8 - - PYMONGO=dev DJANGO=1.4.13 - - PYMONGO=2.5.2 DJANGO=1.6.5 - - PYMONGO=2.5.2 DJANGO=1.5.8 - - PYMONGO=2.5.2 DJANGO=1.4.13 - - PYMONGO=2.6.3 DJANGO=1.6.5 - - PYMONGO=2.6.3 DJANGO=1.5.8 - - PYMONGO=2.6.3 DJANGO=1.4.13 - PYMONGO=2.7.1 DJANGO=1.6.5 - PYMONGO=2.7.1 DJANGO=1.5.8 - - PYMONGO=2.7.1 DJANGO=1.4.13 matrix: fast_finish: true - exclude: - - python: "3.2" - env: PYMONGO=dev DJANGO=1.4.13 - - python: "3.2" - env: PYMONGO=2.5.2 DJANGO=1.4.13 - - python: "3.2" - env: PYMONGO=2.6.3 DJANGO=1.4.13 - - python: "3.2" - env: PYMONGO=2.7.1 DJANGO=1.4.13 - - python: "3.3" - env: PYMONGO=dev DJANGO=1.4.13 - - python: "3.3" - env: PYMONGO=2.5.2 DJANGO=1.4.13 - - python: "3.3" - env: PYMONGO=2.6.3 DJANGO=1.4.13 - - python: "3.3" - env: PYMONGO=2.7.1 DJANGO=1.4.13 - - python: "3.4" - env: PYMONGO=dev DJANGO=1.4.13 - - python: "3.4" - env: PYMONGO=2.5.2 DJANGO=1.4.13 - - python: "3.4" - env: PYMONGO=2.6.3 DJANGO=1.4.13 - - python: "3.4" - env: PYMONGO=2.7.1 DJANGO=1.4.13 + install: - sudo apt-get install python-dev python3-dev libopenjpeg-dev zlib1g-dev libjpeg-turbo8-dev libtiff4-dev libjpeg8-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk - if [[ $PYMONGO == 'dev' ]]; then pip install https://github.com/mongodb/mongo-python-driver/tarball/master; true; fi diff --git a/docs/changelog.rst b/docs/changelog.rst index bead491c..c980e904 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -7,6 +7,8 @@ Changes in 0.9.X - DEV ====================== - pypy support #673 - Enabled connection pooling #674 +- Removing support for Django 1.4.x, pymongo 2.5.x, pymongo 2.6.x. +- Removing support for Python < 2.6.6 Changes in 0.8.7 ================ diff --git a/mongoengine/base/document.py b/mongoengine/base/document.py index f5eae8ff..43b865ce 100644 --- a/mongoengine/base/document.py +++ b/mongoengine/base/document.py @@ -13,8 +13,7 @@ from mongoengine import signals from mongoengine.common import _import_class from mongoengine.errors import (ValidationError, InvalidDocumentError, LookUpError) -from mongoengine.python_support import (PY3, UNICODE_KWARGS, txt_type, - to_str_keys_recursive) +from mongoengine.python_support import PY3, txt_type from mongoengine.base.common import get_document, ALLOW_INHERITANCE from mongoengine.base.datastructures import BaseDict, BaseList @@ -545,10 +544,6 @@ class BaseDocument(object): # class if unavailable class_name = son.get('_cls', cls._class_name) data = dict(("%s" % key, value) for key, value in son.iteritems()) - if not UNICODE_KWARGS: - # python 2.6.4 and lower cannot handle unicode keys - # passed to class constructor example: cls(**data) - to_str_keys_recursive(data) # Return correct subclass for document type if class_name != cls._class_name: diff --git a/mongoengine/python_support.py b/mongoengine/python_support.py index 097740eb..2c4df00c 100644 --- a/mongoengine/python_support.py +++ b/mongoengine/python_support.py @@ -3,8 +3,6 @@ import sys PY3 = sys.version_info[0] == 3 -PY25 = sys.version_info[:2] == (2, 5) -UNICODE_KWARGS = int(''.join([str(x) for x in sys.version_info[:3]])) > 264 if PY3: import codecs @@ -29,33 +27,3 @@ else: txt_type = unicode str_types = (bin_type, txt_type) - -if PY25: - def product(*args, **kwds): - pools = map(tuple, args) * kwds.get('repeat', 1) - result = [[]] - for pool in pools: - result = [x + [y] for x in result for y in pool] - for prod in result: - yield tuple(prod) - reduce = reduce -else: - from itertools import product - from functools import reduce - - -# For use with Python 2.5 -# converts all keys from unicode to str for d and all nested dictionaries -def to_str_keys_recursive(d): - if isinstance(d, list): - for val in d: - if isinstance(val, (dict, list)): - to_str_keys_recursive(val) - elif isinstance(d, dict): - for key, val in d.items(): - if isinstance(val, (dict, list)): - to_str_keys_recursive(val) - if isinstance(key, unicode): - d[str(key)] = d.pop(key) - else: - raise ValueError("non list/dict parameter not allowed") diff --git a/mongoengine/queryset/visitor.py b/mongoengine/queryset/visitor.py index 41f4ebf8..a39b05f0 100644 --- a/mongoengine/queryset/visitor.py +++ b/mongoengine/queryset/visitor.py @@ -1,8 +1,9 @@ import copy -from mongoengine.errors import InvalidQueryError -from mongoengine.python_support import product, reduce +from itertools import product +from functools import reduce +from mongoengine.errors import InvalidQueryError from mongoengine.queryset import transform __all__ = ('Q',) diff --git a/setup.py b/setup.py index d37cede1..7270331a 100644 --- a/setup.py +++ b/setup.py @@ -38,12 +38,14 @@ CLASSIFIERS = [ 'Operating System :: OS Independent', 'Programming Language :: Python', "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.6.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.1", "Programming Language :: Python :: 3.2", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", 'Topic :: Database', 'Topic :: Software Development :: Libraries :: Python Modules', ]