commit python-django-nine for openSUSE:Factory
Hello community, here is the log from the commit of package python-django-nine for openSUSE:Factory checked in at 2019-05-22 15:41:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-django-nine (Old) and /work/SRC/openSUSE:Factory/.python-django-nine.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-django-nine" Wed May 22 15:41:19 2019 rev:2 rq:704708 version:0.2.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-django-nine/python-django-nine.changes 2019-05-22 11:03:49.646612957 +0200 +++ /work/SRC/openSUSE:Factory/.python-django-nine.new.5148/python-django-nine.changes 2019-05-22 15:42:06.850427035 +0200 @@ -1,0 +2,19 @@ +Wed May 22 10:47:49 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com> + +- Update to 0.2.2: + * Fixes in backwards compatibility + * Bring back the user compatibility module. However, it's deprecated and + will be removed in version 0.3 + * Show deprecation warnings + +------------------------------------------------------------------- +Fri May 17 10:34:46 UTC 2019 - John Vandenberg <jayvdb@gmail.com> + +- Removed Conflicts with python-nine +- Update to v0.2 + * Drop Python 2.6 support. + * Change namespace from `nine` to `django_nine`. + * Removed `user` compatibility module. + * Add travis. + +------------------------------------------------------------------- Old: ---- django-nine-0.1.13.tar.gz New: ---- django-nine-0.2.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-django-nine.spec ++++++ --- /var/tmp/diff_new_pack.ZGylVV/_old 2019-05-22 15:42:08.134427029 +0200 +++ /var/tmp/diff_new_pack.ZGylVV/_new 2019-05-22 15:42:08.134427029 +0200 @@ -12,26 +12,25 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-django-nine -Version: 0.1.13 +Version: 0.2.2 Release: 0 -License: GPL-2.0 or LGPL-2.1-or-later Summary: Compatibility library for Django -Url: https://github.com/barseghyanartur/django-nine/ +License: GPL-2.0-only OR LGPL-2.1-or-later Group: Development/Languages/Python +Url: https://github.com/barseghyanartur/django-nine/ Source: https://files.pythonhosted.org/packages/source/d/django-nine/django-nine-%{version}.tar.gz -BuildRequires: python-rpm-macros BuildRequires: %{python_module setuptools} +BuildRequires: python-rpm-macros # SECTION test requirements BuildRequires: %{python_module Django} BuildRequires: %{python_module mock} BuildRequires: %{python_module pytest-django} -# https://github.com/barseghyanartur/django-nine/issues/2 -Conflicts: python-nine # /SECTION BuildRequires: fdupes BuildArch: noarch @@ -39,23 +38,26 @@ %python_subpackages %description -Compatibility library for Django. +Version checking library for Django. %prep %setup -q -n django-nine-%{version} chmod a-x LICENSE_* CHANGELOG.rst README.rst +# Remove backwards compatibility layer +rm src/nine/__init__.py + %build %python_build %install %python_install -%{python_expand rm -r %{buildroot}%{$python_sitelib}/nine/tests/ +%{python_expand rm -r %{buildroot}%{$python_sitelib}/django_nine/tests/ %fdupes %{buildroot}%{$python_sitelib} } %check -%pytest src/nine/tests/ +%pytest src/django_nine/tests/ %files %{python_files} %doc CHANGELOG.rst README.rst ++++++ django-nine-0.1.13.tar.gz -> django-nine-0.2.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/CHANGELOG.rst new/django-nine-0.2.2/CHANGELOG.rst --- old/django-nine-0.1.13/CHANGELOG.rst 2017-05-16 22:25:32.000000000 +0200 +++ new/django-nine-0.2.2/CHANGELOG.rst 2019-05-19 19:15:10.000000000 +0200 @@ -15,6 +15,34 @@ 0.3.2 to 0.4). - All backwards incompatible changes are mentioned in this document. +0.2.2 +--- +2019-05-18 + +- Bring back the `user` compatibility module. However, it's deprecated and + will be removed in version 0.3. +- Show deprecation warnings. + +0.2.1 +--- +2019-05-18 + +- Fixes in backwards compatibility. + +0.2 +--- +2019-05-17 + +.. note:: + + This release is still backwards-compatible with previous versions (0.1.x), + but next versions (0.3.x) would not be. + +- Drop Python 2.6 support. +- Change namespace from `nine` to `django_nine`. +- Removed `user` compatibility module. Implement your own if you need. +- Add travis. + 0.1.13 ------ 2017-05-16 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/LICENSE_GPL2.0.txt new/django-nine-0.2.2/LICENSE_GPL2.0.txt --- old/django-nine-0.1.13/LICENSE_GPL2.0.txt 2017-02-09 22:54:43.000000000 +0100 +++ new/django-nine-0.2.2/LICENSE_GPL2.0.txt 2019-05-16 23:10:20.000000000 +0200 @@ -291,7 +291,7 @@ the "copyright" line and a pointer to where the full notice is found. django-nine - compatibility library for Django. - Copyright (C) 2015-2017 Artur Barseghyan + Copyright (C) 2015-2019 Artur Barseghyan This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/LICENSE_LGPL_2.1.txt new/django-nine-0.2.2/LICENSE_LGPL_2.1.txt --- old/django-nine-0.1.13/LICENSE_LGPL_2.1.txt 2017-02-09 22:54:43.000000000 +0100 +++ new/django-nine-0.2.2/LICENSE_LGPL_2.1.txt 2019-05-16 23:10:20.000000000 +0200 @@ -471,7 +471,7 @@ "copyright" line and a pointer to where the full notice is found. django-nine - compatibility library for Django. - Copyright (C) 2015-2017 Artur Barseghyan + Copyright (C) 2015-2019 Artur Barseghyan This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/PKG-INFO new/django-nine-0.2.2/PKG-INFO --- old/django-nine-0.1.13/PKG-INFO 2017-05-16 22:28:17.000000000 +0200 +++ new/django-nine-0.2.2/PKG-INFO 2019-05-19 19:16:50.000000000 +0200 @@ -1,20 +1,32 @@ Metadata-Version: 1.1 Name: django-nine -Version: 0.1.13 -Summary: Compatibility library for Django. +Version: 0.2.2 +Summary: Version checking library. Home-page: https://github.com/barseghyanartur/django-nine/ Author: Artur Barseghyan Author-email: artur.barseghyan@gmail.com -License: GPL 2.0/LGPL 2.1 +License: GPL-2.0-only OR LGPL-2.1-or-later Description: =========== django-nine =========== - `django-nine` - compatibility library for Django. + `django-nine` - version checking library for Django. + + .. image:: https://img.shields.io/pypi/v/django-nine.svg + :target: https://pypi.python.org/pypi/django-nine + :alt: PyPI Version + + .. image:: https://img.shields.io/travis/barseghyanartur/django-nine/master.svg + :target: http://travis-ci.org/barseghyanartur/django-nine + :alt: Build Status + + .. image:: https://img.shields.io/badge/license-GPL--2.0--only%20OR%20LGPL--2.1--or--la... + :target: https://github.com/barseghyanartur/django-nine/#License + :alt: GPL-2.0-only OR LGPL-2.1-or-later Prerequisites ============= - - Python 2.6, 2.7, 3.4, 3.5 and 3.6. - - Django 1.5, 1.6, 1.7, 1.8, 1.9, 1.10 and 1.11. + - Python 2.6, 2.7, 3.4, 3.5, 3.6 and 3.7. + - Django 1.5, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11, 2.0, 2.1 and 2.2. Installation ============ @@ -47,7 +59,7 @@ .. code-block:: python - from nine import versions + from django_nine import versions versions.DJANGO_1_7 # True versions.DJANGO_LTE_1_7 # True @@ -65,21 +77,13 @@ .. code-block:: python TEMPLATES[0]['OPTIONS']['context_processors'] += \ - ['nine.context_processors.versions'] + ['django_nine.context_processors.versions'] Or if you are using an old version of Django: .. code-block:: python - TEMPLATE_CONTEXT_PROCESSORS += ['nine.context_processors.versions'] - - Import User model - ----------------- - Or you could safely import the user model as follows: - - .. code-block:: python - - from nine.user import User + TEMPLATE_CONTEXT_PROCESSORS += ['django_nine.context_processors.versions'] Testing ======= @@ -99,7 +103,7 @@ .. code-block:: sh - tox -e py35 + tox -e py37 Or run Django tests: @@ -109,7 +113,7 @@ License ======= - GPL 2.0/LGPL 2.1 + GPL-2.0-only OR LGPL-2.1-or-later Support ======= @@ -128,6 +132,7 @@ Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Classifier: Environment :: Web Environment Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2) Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/README.rst new/django-nine-0.2.2/README.rst --- old/django-nine-0.1.13/README.rst 2017-05-16 22:24:55.000000000 +0200 +++ new/django-nine-0.2.2/README.rst 2019-05-16 23:10:20.000000000 +0200 @@ -1,12 +1,24 @@ =========== django-nine =========== -`django-nine` - compatibility library for Django. +`django-nine` - version checking library for Django. + +.. image:: https://img.shields.io/pypi/v/django-nine.svg + :target: https://pypi.python.org/pypi/django-nine + :alt: PyPI Version + +.. image:: https://img.shields.io/travis/barseghyanartur/django-nine/master.svg + :target: http://travis-ci.org/barseghyanartur/django-nine + :alt: Build Status + +.. image:: https://img.shields.io/badge/license-GPL--2.0--only%20OR%20LGPL--2.1--or--la... + :target: https://github.com/barseghyanartur/django-nine/#License + :alt: GPL-2.0-only OR LGPL-2.1-or-later Prerequisites ============= -- Python 2.6, 2.7, 3.4, 3.5 and 3.6. -- Django 1.5, 1.6, 1.7, 1.8, 1.9, 1.10 and 1.11. +- Python 2.6, 2.7, 3.4, 3.5, 3.6 and 3.7. +- Django 1.5, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11, 2.0, 2.1 and 2.2. Installation ============ @@ -39,7 +51,7 @@ .. code-block:: python - from nine import versions + from django_nine import versions versions.DJANGO_1_7 # True versions.DJANGO_LTE_1_7 # True @@ -57,21 +69,13 @@ .. code-block:: python TEMPLATES[0]['OPTIONS']['context_processors'] += \ - ['nine.context_processors.versions'] + ['django_nine.context_processors.versions'] Or if you are using an old version of Django: .. code-block:: python - TEMPLATE_CONTEXT_PROCESSORS += ['nine.context_processors.versions'] - -Import User model ------------------ -Or you could safely import the user model as follows: - -.. code-block:: python - - from nine.user import User + TEMPLATE_CONTEXT_PROCESSORS += ['django_nine.context_processors.versions'] Testing ======= @@ -91,7 +95,7 @@ .. code-block:: sh - tox -e py35 + tox -e py37 Or run Django tests: @@ -101,7 +105,7 @@ License ======= -GPL 2.0/LGPL 2.1 +GPL-2.0-only OR LGPL-2.1-or-later Support ======= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/setup.cfg new/django-nine-0.2.2/setup.cfg --- old/django-nine-0.1.13/setup.cfg 2017-05-16 22:28:17.000000000 +0200 +++ new/django-nine-0.2.2/setup.cfg 2019-05-19 19:16:50.000000000 +0200 @@ -4,5 +4,4 @@ [egg_info] tag_build = tag_date = 0 -tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/setup.py new/django-nine-0.2.2/setup.py --- old/django-nine-0.1.13/setup.py 2017-05-16 22:25:40.000000000 +0200 +++ new/django-nine-0.2.2/setup.py 2019-05-19 19:15:17.000000000 +0200 @@ -7,7 +7,7 @@ except: readme = '' -version = '0.1.13' +version = '0.2.2' install_requires = [ #'Django', @@ -32,7 +32,7 @@ setup( name='django-nine', version=version, - description="Compatibility library for Django.", + description="Version checking library.", long_description="{0}".format(readme), classifiers=[ "Programming Language :: Python :: 2.6", @@ -42,6 +42,7 @@ "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", "Environment :: Web Environment", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "License :: OSI Approved :: GNU Lesser General Public License v2 or " @@ -57,7 +58,7 @@ url='https://github.com/barseghyanartur/django-nine/', package_dir={'': 'src'}, packages=find_packages(where='./src'), - license='GPL 2.0/LGPL 2.1', + license='GPL-2.0-only OR LGPL-2.1-or-later', install_requires=install_requires, tests_require=tests_require, package_data={}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/django_nine/__init__.py new/django-nine-0.2.2/src/django_nine/__init__.py --- old/django-nine-0.1.13/src/django_nine/__init__.py 1970-01-01 01:00:00.000000000 +0100 +++ new/django-nine-0.2.2/src/django_nine/__init__.py 2019-05-19 19:09:28.000000000 +0200 @@ -0,0 +1,5 @@ +__title__ = 'django_nine' +__version__ = '0.2.2' +__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>' +__copyright__ = '2015-2019 Artur Barseghyan' +__license__ = 'GPL-2.0-only OR LGPL-2.1-or-later' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/django_nine/context_processors.py new/django-nine-0.2.2/src/django_nine/context_processors.py --- old/django-nine-0.1.13/src/django_nine/context_processors.py 1970-01-01 01:00:00.000000000 +0100 +++ new/django-nine-0.2.2/src/django_nine/context_processors.py 2019-05-16 23:10:20.000000000 +0200 @@ -0,0 +1,18 @@ +from django_nine import versions as nine_versions + +__title__ = 'django_nine.versions' +__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>' +__copyright__ = '2015-2019 Artur Barseghyan' +__license__ = 'GPL-2.0-only OR LGPL-2.1-or-later' +__all__ = [ + 'versions', +] + + +def versions(request): + """Get active theme. + + :param django.http.HttpRequest request: + :return dict: + """ + return {'VERSIONS': nine_versions} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/django_nine/tests/__init__.py new/django-nine-0.2.2/src/django_nine/tests/__init__.py --- old/django-nine-0.1.13/src/django_nine/tests/__init__.py 1970-01-01 01:00:00.000000000 +0100 +++ new/django-nine-0.2.2/src/django_nine/tests/__init__.py 2019-05-16 23:10:20.000000000 +0200 @@ -0,0 +1 @@ +from .test_versions import * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/django_nine/tests/base.py new/django-nine-0.2.2/src/django_nine/tests/base.py --- old/django-nine-0.1.13/src/django_nine/tests/base.py 1970-01-01 01:00:00.000000000 +0100 +++ new/django-nine-0.2.2/src/django_nine/tests/base.py 2019-05-16 23:10:20.000000000 +0200 @@ -0,0 +1,36 @@ +import logging + +__title__ = 'django_nine.tests.base' +__author__ = 'Artur Barseghyan' +__copyright__ = '2015-2019 Artur Barseghyan' +__license__ = 'GPL-2.0-only OR LGPL-2.1-or-later' +__all__ = ( + 'LOG_INFO', + 'log_info', +) + + +logger = logging.getLogger(__name__) + +LOG_INFO = True + + +def log_info(func): + """Logs some useful info.""" + if not LOG_INFO: + return func + + def inner(self, *args, **kwargs): + result = func(self, *args, **kwargs) + + logger.info('\n\n%s' % func.__name__) + logger.info('============================') + if func.__doc__: + logger.info('""" %s """' % func.__doc__.strip()) + logger.info('----------------------------') + if result is not None: + logger.info(result) + logger.info('\n++++++++++++++++++++++++++++') + + return result + return inner diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/django_nine/tests/test_versions.py new/django-nine-0.2.2/src/django_nine/tests/test_versions.py --- old/django-nine-0.1.13/src/django_nine/tests/test_versions.py 1970-01-01 01:00:00.000000000 +0100 +++ new/django-nine-0.2.2/src/django_nine/tests/test_versions.py 2019-05-16 23:10:20.000000000 +0200 @@ -0,0 +1,233 @@ +import unittest +import mock +# For Python3 >= 3.4 +try: + from importlib import reload +# For Python3 < 3.4 +except ImportError as err: + try: + from imp import reload + except ImportError as err: + pass + +import django + +from .base import log_info + +__title__ = 'django_nine.tests.test_versions' +__author__ = 'Artur Barseghyan' +__copyright__ = 'Copyright (c) 2015 Artur Barseghyan' +__license__ = 'GPL-2.0-only OR LGPL-2.1-or-later' +__all__ = ('VersionsTest',) + + +class VersionsTest(unittest.TestCase): + """ + Tests of ``django_nine.versions`` module. + """ + def setUp(self): + pass + + @log_info + @mock.patch('django.get_version', mock.MagicMock(return_value='1.4.21')) + def test_django_1_4_21(self): + """ + Tests as if we were using Django==1.4.21. + """ + from django_nine import versions + reload(versions) + + # Exact version matching + self.assertTrue(versions.DJANGO_1_4) + self.assertTrue(not versions.DJANGO_1_5) + self.assertTrue(not versions.DJANGO_1_6) + self.assertTrue(not versions.DJANGO_1_7) + self.assertTrue(not versions.DJANGO_1_8) + self.assertTrue(not versions.DJANGO_1_9) + + # Less than or equal matching + self.assertTrue(versions.DJANGO_LTE_1_4) + self.assertTrue(versions.DJANGO_LTE_1_5) + self.assertTrue(versions.DJANGO_LTE_1_6) + self.assertTrue(versions.DJANGO_LTE_1_7) + self.assertTrue(versions.DJANGO_LTE_1_8) + self.assertTrue(versions.DJANGO_LTE_1_9) + + # Greater than or equal matching + self.assertTrue(versions.DJANGO_GTE_1_4) + self.assertTrue(not versions.DJANGO_GTE_1_5) + self.assertTrue(not versions.DJANGO_GTE_1_6) + self.assertTrue(not versions.DJANGO_GTE_1_7) + self.assertTrue(not versions.DJANGO_GTE_1_8) + self.assertTrue(not versions.DJANGO_GTE_1_9) + + @log_info + @mock.patch('django.get_version', mock.MagicMock(return_value='1.5.5')) + def test_django_1_5_5(self): + """ + Tests as if we were using Django==1.5.5. + """ + from django_nine import versions + reload(versions) + + # Exact version matching + self.assertTrue(not versions.DJANGO_1_4) + self.assertTrue(versions.DJANGO_1_5) + self.assertTrue(not versions.DJANGO_1_6) + self.assertTrue(not versions.DJANGO_1_7) + self.assertTrue(not versions.DJANGO_1_8) + self.assertTrue(not versions.DJANGO_1_9) + + # Less than or equal matching + self.assertTrue(not versions.DJANGO_LTE_1_4) + self.assertTrue(versions.DJANGO_LTE_1_5) + self.assertTrue(versions.DJANGO_LTE_1_6) + self.assertTrue(versions.DJANGO_LTE_1_7) + self.assertTrue(versions.DJANGO_LTE_1_8) + self.assertTrue(versions.DJANGO_LTE_1_9) + + # Greater than or equal matching + self.assertTrue(versions.DJANGO_GTE_1_4) + self.assertTrue(versions.DJANGO_GTE_1_5) + self.assertTrue(not versions.DJANGO_GTE_1_6) + self.assertTrue(not versions.DJANGO_GTE_1_7) + self.assertTrue(not versions.DJANGO_GTE_1_8) + self.assertTrue(not versions.DJANGO_GTE_1_9) + + @log_info + @mock.patch('django.get_version', mock.MagicMock(return_value='1.6.5')) + def test_django_1_6_5(self): + """ + Tests as if we were using Django==1.6.5. + """ + from django_nine import versions + reload(versions) + + # Exact version matching + self.assertTrue(not versions.DJANGO_1_4) + self.assertTrue(not versions.DJANGO_1_5) + self.assertTrue(versions.DJANGO_1_6) + self.assertTrue(not versions.DJANGO_1_7) + self.assertTrue(not versions.DJANGO_1_8) + self.assertTrue(not versions.DJANGO_1_9) + + # Less than or equal matching + self.assertTrue(not versions.DJANGO_LTE_1_4) + self.assertTrue(not versions.DJANGO_LTE_1_5) + self.assertTrue(versions.DJANGO_LTE_1_6) + self.assertTrue(versions.DJANGO_LTE_1_7) + self.assertTrue(versions.DJANGO_LTE_1_8) + self.assertTrue(versions.DJANGO_LTE_1_9) + + # Greater than or equal matching + self.assertTrue(versions.DJANGO_GTE_1_4) + self.assertTrue(versions.DJANGO_GTE_1_5) + self.assertTrue(versions.DJANGO_GTE_1_6) + self.assertTrue(not versions.DJANGO_GTE_1_7) + self.assertTrue(not versions.DJANGO_GTE_1_8) + self.assertTrue(not versions.DJANGO_GTE_1_9) + + @log_info + @mock.patch('django.get_version', mock.MagicMock(return_value='1.7.5')) + def test_django_1_7_5(self): + """ + Tests as if we were using Django==1.7.5. + """ + from django_nine import versions + reload(versions) + + # Exact version matching + self.assertTrue(not versions.DJANGO_1_4) + self.assertTrue(not versions.DJANGO_1_5) + self.assertTrue(not versions.DJANGO_1_6) + self.assertTrue(versions.DJANGO_1_7) + self.assertTrue(not versions.DJANGO_1_8) + self.assertTrue(not versions.DJANGO_1_9) + + # Less than or equal matching + self.assertTrue(not versions.DJANGO_LTE_1_4) + self.assertTrue(not versions.DJANGO_LTE_1_5) + self.assertTrue(not versions.DJANGO_LTE_1_6) + self.assertTrue(versions.DJANGO_LTE_1_7) + self.assertTrue(versions.DJANGO_LTE_1_8) + self.assertTrue(versions.DJANGO_LTE_1_9) + + # Greater than or equal matching + self.assertTrue(versions.DJANGO_GTE_1_4) + self.assertTrue(versions.DJANGO_GTE_1_5) + self.assertTrue(versions.DJANGO_GTE_1_6) + self.assertTrue(versions.DJANGO_GTE_1_7) + self.assertTrue(not versions.DJANGO_GTE_1_8) + self.assertTrue(not versions.DJANGO_GTE_1_9) + + @log_info + @mock.patch('django.get_version', mock.MagicMock(return_value='1.8.a1')) + def test_django_1_8_a1(self): + """ + Tests as if we were using Django==1.8.a1. + """ + from django_nine import versions + reload(versions) + + # Exact version matching + self.assertTrue(not versions.DJANGO_1_4) + self.assertTrue(not versions.DJANGO_1_5) + self.assertTrue(not versions.DJANGO_1_6) + self.assertTrue(not versions.DJANGO_1_7) + self.assertTrue(versions.DJANGO_1_8) + self.assertTrue(not versions.DJANGO_1_9) + + # Less than or equal matching + self.assertTrue(not versions.DJANGO_LTE_1_4) + self.assertTrue(not versions.DJANGO_LTE_1_5) + self.assertTrue(not versions.DJANGO_LTE_1_6) + self.assertTrue(not versions.DJANGO_LTE_1_7) + self.assertTrue(versions.DJANGO_LTE_1_8) + self.assertTrue(versions.DJANGO_LTE_1_9) + + # Greater than or equal matching + self.assertTrue(versions.DJANGO_GTE_1_4) + self.assertTrue(versions.DJANGO_GTE_1_5) + self.assertTrue(versions.DJANGO_GTE_1_6) + self.assertTrue(versions.DJANGO_GTE_1_7) + self.assertTrue(versions.DJANGO_GTE_1_8) + self.assertTrue(not versions.DJANGO_GTE_1_9) + + @log_info + @mock.patch('django.get_version', mock.MagicMock(return_value='1.10')) + def test_django_1_10(self): + """ + Tests as if we were using Django==1.10. + """ + from django_nine import versions + reload(versions) + + # Exact version matching + self.assertTrue(not versions.DJANGO_1_4) + self.assertTrue(not versions.DJANGO_1_5) + self.assertTrue(not versions.DJANGO_1_6) + self.assertTrue(not versions.DJANGO_1_7) + self.assertTrue(not versions.DJANGO_1_8) + self.assertTrue(not versions.DJANGO_1_9) + self.assertTrue(versions.DJANGO_1_10) + + # Less than or equal matching + self.assertTrue(not versions.DJANGO_LTE_1_4) + self.assertTrue(not versions.DJANGO_LTE_1_5) + self.assertTrue(not versions.DJANGO_LTE_1_6) + self.assertTrue(not versions.DJANGO_LTE_1_7) + self.assertTrue(not versions.DJANGO_LTE_1_8) + self.assertTrue(not versions.DJANGO_LTE_1_9) + + # Greater than or equal matching + self.assertTrue(versions.DJANGO_GTE_1_4) + self.assertTrue(versions.DJANGO_GTE_1_5) + self.assertTrue(versions.DJANGO_GTE_1_6) + self.assertTrue(versions.DJANGO_GTE_1_7) + self.assertTrue(versions.DJANGO_GTE_1_8) + self.assertTrue(versions.DJANGO_GTE_1_9) + self.assertTrue(versions.DJANGO_GTE_1_10) + + +if __name__ == "__main__": + unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/django_nine/user.py new/django-nine-0.2.2/src/django_nine/user.py --- old/django-nine-0.1.13/src/django_nine/user.py 1970-01-01 01:00:00.000000000 +0100 +++ new/django-nine-0.2.2/src/django_nine/user.py 2019-05-19 19:13:56.000000000 +0200 @@ -0,0 +1,51 @@ +""" +Compatibility module for safe and sane User model import. +""" + +import importlib +import warnings + +from django.conf import settings +from django.core.exceptions import ImproperlyConfigured + +from .versions import DJANGO_LTE_1_4, DJANGO_LTE_1_6, DJANGO_GTE_1_7 + +if DJANGO_LTE_1_4: + from django.contrib.auth.models import User +else: + # Cannot use contrib.auth.get_user_model() at compile time. + user_app_name, user_model_name = settings.AUTH_USER_MODEL.rsplit('.', 1) + User = None + + if DJANGO_LTE_1_6: + for app in settings.INSTALLED_APPS: + if app.endswith(user_app_name): + user_app_models = importlib.import_module(app + ".models") + User = getattr(user_app_models, user_model_name) + break + elif DJANGO_GTE_1_7: + from django.apps import apps + try: + User = apps.get_registered_model(user_app_name, user_model_name) + except KeyError: + pass + + if User is None: + raise ImproperlyConfigured( + "You have defined a custom user model {0}, but the app {1} is " + "not in ``settings.INSTALLED_APPS``" + "".format(settings.AUTH_USER_MODEL, user_app_name) + ) + +__title__ = 'nine.user' +__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>' +__copyright__ = 'Copyright (c) 2015-2017 Artur Barseghyan' +__license__ = 'GPL 2.0/LGPL 2.1' +__all__ = ('User',) + + +warnings.warn( + "The `django_nine.user` module is deprecated and will be removed in " + "version 0.3.", + DeprecationWarning +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/django_nine/versions.py new/django-nine-0.2.2/src/django_nine/versions.py --- old/django-nine-0.1.13/src/django_nine/versions.py 1970-01-01 01:00:00.000000000 +0100 +++ new/django-nine-0.2.2/src/django_nine/versions.py 2019-05-16 23:10:20.000000000 +0200 @@ -0,0 +1,81 @@ +""" +Contains information about the current Django version in use, including (LTE +and GTE). +""" + +from distutils.version import LooseVersion + +import django + +__title__ = 'django_nine.versions' +__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>' +__copyright__ = '2015-2019 Artur Barseghyan' +__license__ = 'GPL-2.0-only OR LGPL-2.1-or-later' +__all__ = [ + 'LOOSE_DJANGO_VERSION', 'LOOSE_DJANGO_MINOR_VERSION', +] + +LOOSE_DJANGO_VERSION = LooseVersion(django.get_version()) +LOOSE_DJANGO_MINOR_VERSION = LooseVersion( + '.'.join([str(i) for i in LOOSE_DJANGO_VERSION.version[0:2]]) +) + +# Loose versions +LOOSE_VERSIONS = ( + '1.4', '1.5', '1.6', '1.7', '1.8', '1.9', '1.10', '1.11', '2.0', '2.1', + '2.2', '3.0' +) + +for v in LOOSE_VERSIONS: + var_name = 'LOOSE_VERSION_{0}'.format(v.replace('.', '_')) + globals()[var_name] = LooseVersion(v) + __all__.append(var_name) + +# Exact versions +EXACT_VERSIONS = LOOSE_VERSIONS[:-1] + +for i, v in enumerate(EXACT_VERSIONS): + l_cur = globals()['LOOSE_VERSION_{0}' + ''.format(LOOSE_VERSIONS[i].replace('.', '_'))] + l_nxt = globals()['LOOSE_VERSION_{0}' + ''.format(LOOSE_VERSIONS[i+1].replace('.', '_'))] + var_name = 'DJANGO_{0}'.format(v.replace('.', '_')) + globals()[var_name] = (l_cur <= LOOSE_DJANGO_VERSION < l_nxt) + __all__.append(var_name) + +# LTE list +LTE_VERSIONS = LOOSE_VERSIONS[:-1] + +for i, v in enumerate(EXACT_VERSIONS): + l_cur = globals()['LOOSE_VERSION_{0}' + ''.format(LOOSE_VERSIONS[i].replace('.', '_'))] + var_name = 'DJANGO_LTE_{0}'.format(v.replace('.', '_')) + globals()[var_name] = (LOOSE_DJANGO_MINOR_VERSION <= l_cur) + __all__.append(var_name) + +# GTE list +GTE_VERSIONS = LOOSE_VERSIONS[:-1] + +for i, v in enumerate(EXACT_VERSIONS): + l_cur = globals()['LOOSE_VERSION_{0}' + ''.format(LOOSE_VERSIONS[i].replace('.', '_'))] + var_name = 'DJANGO_GTE_{0}'.format(v.replace('.', '_')) + globals()[var_name] = ( + LOOSE_DJANGO_MINOR_VERSION >= l_cur + ) + __all__.append(var_name) + +__all__ = tuple(__all__) + +# Clean up +try: + del l_cur + del l_nxt + del var_name + del i + del v +except NameError: + pass + +del LooseVersion +del django diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/django_nine.egg-info/PKG-INFO new/django-nine-0.2.2/src/django_nine.egg-info/PKG-INFO --- old/django-nine-0.1.13/src/django_nine.egg-info/PKG-INFO 2017-05-16 22:28:17.000000000 +0200 +++ new/django-nine-0.2.2/src/django_nine.egg-info/PKG-INFO 2019-05-19 19:16:50.000000000 +0200 @@ -1,20 +1,32 @@ Metadata-Version: 1.1 Name: django-nine -Version: 0.1.13 -Summary: Compatibility library for Django. +Version: 0.2.2 +Summary: Version checking library. Home-page: https://github.com/barseghyanartur/django-nine/ Author: Artur Barseghyan Author-email: artur.barseghyan@gmail.com -License: GPL 2.0/LGPL 2.1 +License: GPL-2.0-only OR LGPL-2.1-or-later Description: =========== django-nine =========== - `django-nine` - compatibility library for Django. + `django-nine` - version checking library for Django. + + .. image:: https://img.shields.io/pypi/v/django-nine.svg + :target: https://pypi.python.org/pypi/django-nine + :alt: PyPI Version + + .. image:: https://img.shields.io/travis/barseghyanartur/django-nine/master.svg + :target: http://travis-ci.org/barseghyanartur/django-nine + :alt: Build Status + + .. image:: https://img.shields.io/badge/license-GPL--2.0--only%20OR%20LGPL--2.1--or--la... + :target: https://github.com/barseghyanartur/django-nine/#License + :alt: GPL-2.0-only OR LGPL-2.1-or-later Prerequisites ============= - - Python 2.6, 2.7, 3.4, 3.5 and 3.6. - - Django 1.5, 1.6, 1.7, 1.8, 1.9, 1.10 and 1.11. + - Python 2.6, 2.7, 3.4, 3.5, 3.6 and 3.7. + - Django 1.5, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11, 2.0, 2.1 and 2.2. Installation ============ @@ -47,7 +59,7 @@ .. code-block:: python - from nine import versions + from django_nine import versions versions.DJANGO_1_7 # True versions.DJANGO_LTE_1_7 # True @@ -65,21 +77,13 @@ .. code-block:: python TEMPLATES[0]['OPTIONS']['context_processors'] += \ - ['nine.context_processors.versions'] + ['django_nine.context_processors.versions'] Or if you are using an old version of Django: .. code-block:: python - TEMPLATE_CONTEXT_PROCESSORS += ['nine.context_processors.versions'] - - Import User model - ----------------- - Or you could safely import the user model as follows: - - .. code-block:: python - - from nine.user import User + TEMPLATE_CONTEXT_PROCESSORS += ['django_nine.context_processors.versions'] Testing ======= @@ -99,7 +103,7 @@ .. code-block:: sh - tox -e py35 + tox -e py37 Or run Django tests: @@ -109,7 +113,7 @@ License ======= - GPL 2.0/LGPL 2.1 + GPL-2.0-only OR LGPL-2.1-or-later Support ======= @@ -128,6 +132,7 @@ Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Classifier: Environment :: Web Environment Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2) Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/django_nine.egg-info/SOURCES.txt new/django-nine-0.2.2/src/django_nine.egg-info/SOURCES.txt --- old/django-nine-0.1.13/src/django_nine.egg-info/SOURCES.txt 2017-05-16 22:28:17.000000000 +0200 +++ new/django-nine-0.2.2/src/django_nine.egg-info/SOURCES.txt 2019-05-19 19:16:50.000000000 +0200 @@ -5,15 +5,18 @@ README.rst setup.cfg setup.py +src/django_nine/__init__.py +src/django_nine/context_processors.py +src/django_nine/models.py +src/django_nine/user.py +src/django_nine/versions.py src/django_nine.egg-info/PKG-INFO src/django_nine.egg-info/SOURCES.txt src/django_nine.egg-info/dependency_links.txt src/django_nine.egg-info/top_level.txt +src/django_nine/tests/__init__.py +src/django_nine/tests/base.py +src/django_nine/tests/test_versions.py src/nine/__init__.py -src/nine/context_processors.py -src/nine/models.py src/nine/user.py -src/nine/versions.py -src/nine/tests/__init__.py -src/nine/tests/base.py -src/nine/tests/test_versions.py \ No newline at end of file +src/nine/versions.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/django_nine.egg-info/top_level.txt new/django-nine-0.2.2/src/django_nine.egg-info/top_level.txt --- old/django-nine-0.1.13/src/django_nine.egg-info/top_level.txt 2017-05-16 22:28:17.000000000 +0200 +++ new/django-nine-0.2.2/src/django_nine.egg-info/top_level.txt 2019-05-19 19:16:50.000000000 +0200 @@ -1 +1,2 @@ +django_nine nine diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/nine/__init__.py new/django-nine-0.2.2/src/nine/__init__.py --- old/django-nine-0.1.13/src/nine/__init__.py 2017-05-16 22:25:52.000000000 +0200 +++ new/django-nine-0.2.2/src/nine/__init__.py 2019-05-19 19:14:57.000000000 +0200 @@ -1,6 +1,9 @@ -__title__ = 'django-nine' -__version__ = '0.1.13' -__build__ = 0x00000e -__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>' -__copyright__ = '2015-2017 Artur Barseghyan' -__license__ = 'GPL 2.0/LGPL 2.1' +import warnings + +from django_nine import versions # NOQA +from django_nine import context_processors # NOQA + +warnings.warn( + "The `nine` namespace is deprecated, use `django_nine` instead.", + DeprecationWarning +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/nine/context_processors.py new/django-nine-0.2.2/src/nine/context_processors.py --- old/django-nine-0.1.13/src/nine/context_processors.py 2017-05-16 22:20:35.000000000 +0200 +++ new/django-nine-0.2.2/src/nine/context_processors.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -from nine import versions as nine_versions - -__title__ = 'nine.versions' -__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>' -__copyright__ = 'Copyright (c) 2015-2017 Artur Barseghyan' -__license__ = 'GPL 2.0/LGPL 2.1' -__all__ = [ - 'versions', -] - - -def versions(request): - """Get active theme. - - :param django.http.HttpRequest request: - :return dict: - """ - return {'VERSIONS': nine_versions} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/nine/tests/__init__.py new/django-nine-0.2.2/src/nine/tests/__init__.py --- old/django-nine-0.1.13/src/nine/tests/__init__.py 2015-08-24 23:18:14.000000000 +0200 +++ new/django-nine-0.2.2/src/nine/tests/__init__.py 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -from .test_versions import * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/nine/tests/base.py new/django-nine-0.2.2/src/nine/tests/base.py --- old/django-nine-0.1.13/src/nine/tests/base.py 2017-02-09 22:54:43.000000000 +0100 +++ new/django-nine-0.2.2/src/nine/tests/base.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,36 +0,0 @@ -import logging - -__title__ = 'nine.tests.base' -__author__ = 'Artur Barseghyan' -__copyright__ = 'Copyright (c) 2015-2017 Artur Barseghyan' -__license__ = 'GPL 2.0/LGPL 2.1' -__all__ = ( - 'LOG_INFO', - 'log_info', -) - - -logger = logging.getLogger(__name__) - -LOG_INFO = True - - -def log_info(func): - """Logs some useful info.""" - if not LOG_INFO: - return func - - def inner(self, *args, **kwargs): - result = func(self, *args, **kwargs) - - logger.info('\n\n%s' % func.__name__) - logger.info('============================') - if func.__doc__: - logger.info('""" %s """' % func.__doc__.strip()) - logger.info('----------------------------') - if result is not None: - logger.info(result) - logger.info('\n++++++++++++++++++++++++++++') - - return result - return inner diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/nine/tests/test_versions.py new/django-nine-0.2.2/src/nine/tests/test_versions.py --- old/django-nine-0.1.13/src/nine/tests/test_versions.py 2016-11-30 23:12:59.000000000 +0100 +++ new/django-nine-0.2.2/src/nine/tests/test_versions.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,233 +0,0 @@ -import unittest -import mock -# For Python3 >= 3.4 -try: - from importlib import reload -# For Python3 < 3.4 -except ImportError as err: - try: - from imp import reload - except ImportError as err: - pass - -import django - -from .base import log_info - -__title__ = 'nine.tests.test_versions' -__author__ = 'Artur Barseghyan' -__copyright__ = 'Copyright (c) 2015 Artur Barseghyan' -__license__ = 'GPL 2.0/LGPL 2.1' -__all__ = ('VersionsTest',) - - -class VersionsTest(unittest.TestCase): - """ - Tests of ``nine.versions`` module. - """ - def setUp(self): - pass - - @log_info - @mock.patch('django.get_version', mock.MagicMock(return_value='1.4.21')) - def test_django_1_4_21(self): - """ - Tests as if we were using Django==1.4.21. - """ - from nine import versions - reload(versions) - - # Exact version matching - self.assertTrue(versions.DJANGO_1_4) - self.assertTrue(not versions.DJANGO_1_5) - self.assertTrue(not versions.DJANGO_1_6) - self.assertTrue(not versions.DJANGO_1_7) - self.assertTrue(not versions.DJANGO_1_8) - self.assertTrue(not versions.DJANGO_1_9) - - # Less than or equal matching - self.assertTrue(versions.DJANGO_LTE_1_4) - self.assertTrue(versions.DJANGO_LTE_1_5) - self.assertTrue(versions.DJANGO_LTE_1_6) - self.assertTrue(versions.DJANGO_LTE_1_7) - self.assertTrue(versions.DJANGO_LTE_1_8) - self.assertTrue(versions.DJANGO_LTE_1_9) - - # Greater than or equal matching - self.assertTrue(versions.DJANGO_GTE_1_4) - self.assertTrue(not versions.DJANGO_GTE_1_5) - self.assertTrue(not versions.DJANGO_GTE_1_6) - self.assertTrue(not versions.DJANGO_GTE_1_7) - self.assertTrue(not versions.DJANGO_GTE_1_8) - self.assertTrue(not versions.DJANGO_GTE_1_9) - - @log_info - @mock.patch('django.get_version', mock.MagicMock(return_value='1.5.5')) - def test_django_1_5_5(self): - """ - Tests as if we were using Django==1.5.5. - """ - from nine import versions - reload(versions) - - # Exact version matching - self.assertTrue(not versions.DJANGO_1_4) - self.assertTrue(versions.DJANGO_1_5) - self.assertTrue(not versions.DJANGO_1_6) - self.assertTrue(not versions.DJANGO_1_7) - self.assertTrue(not versions.DJANGO_1_8) - self.assertTrue(not versions.DJANGO_1_9) - - # Less than or equal matching - self.assertTrue(not versions.DJANGO_LTE_1_4) - self.assertTrue(versions.DJANGO_LTE_1_5) - self.assertTrue(versions.DJANGO_LTE_1_6) - self.assertTrue(versions.DJANGO_LTE_1_7) - self.assertTrue(versions.DJANGO_LTE_1_8) - self.assertTrue(versions.DJANGO_LTE_1_9) - - # Greater than or equal matching - self.assertTrue(versions.DJANGO_GTE_1_4) - self.assertTrue(versions.DJANGO_GTE_1_5) - self.assertTrue(not versions.DJANGO_GTE_1_6) - self.assertTrue(not versions.DJANGO_GTE_1_7) - self.assertTrue(not versions.DJANGO_GTE_1_8) - self.assertTrue(not versions.DJANGO_GTE_1_9) - - @log_info - @mock.patch('django.get_version', mock.MagicMock(return_value='1.6.5')) - def test_django_1_6_5(self): - """ - Tests as if we were using Django==1.6.5. - """ - from nine import versions - reload(versions) - - # Exact version matching - self.assertTrue(not versions.DJANGO_1_4) - self.assertTrue(not versions.DJANGO_1_5) - self.assertTrue(versions.DJANGO_1_6) - self.assertTrue(not versions.DJANGO_1_7) - self.assertTrue(not versions.DJANGO_1_8) - self.assertTrue(not versions.DJANGO_1_9) - - # Less than or equal matching - self.assertTrue(not versions.DJANGO_LTE_1_4) - self.assertTrue(not versions.DJANGO_LTE_1_5) - self.assertTrue(versions.DJANGO_LTE_1_6) - self.assertTrue(versions.DJANGO_LTE_1_7) - self.assertTrue(versions.DJANGO_LTE_1_8) - self.assertTrue(versions.DJANGO_LTE_1_9) - - # Greater than or equal matching - self.assertTrue(versions.DJANGO_GTE_1_4) - self.assertTrue(versions.DJANGO_GTE_1_5) - self.assertTrue(versions.DJANGO_GTE_1_6) - self.assertTrue(not versions.DJANGO_GTE_1_7) - self.assertTrue(not versions.DJANGO_GTE_1_8) - self.assertTrue(not versions.DJANGO_GTE_1_9) - - @log_info - @mock.patch('django.get_version', mock.MagicMock(return_value='1.7.5')) - def test_django_1_7_5(self): - """ - Tests as if we were using Django==1.7.5. - """ - from nine import versions - reload(versions) - - # Exact version matching - self.assertTrue(not versions.DJANGO_1_4) - self.assertTrue(not versions.DJANGO_1_5) - self.assertTrue(not versions.DJANGO_1_6) - self.assertTrue(versions.DJANGO_1_7) - self.assertTrue(not versions.DJANGO_1_8) - self.assertTrue(not versions.DJANGO_1_9) - - # Less than or equal matching - self.assertTrue(not versions.DJANGO_LTE_1_4) - self.assertTrue(not versions.DJANGO_LTE_1_5) - self.assertTrue(not versions.DJANGO_LTE_1_6) - self.assertTrue(versions.DJANGO_LTE_1_7) - self.assertTrue(versions.DJANGO_LTE_1_8) - self.assertTrue(versions.DJANGO_LTE_1_9) - - # Greater than or equal matching - self.assertTrue(versions.DJANGO_GTE_1_4) - self.assertTrue(versions.DJANGO_GTE_1_5) - self.assertTrue(versions.DJANGO_GTE_1_6) - self.assertTrue(versions.DJANGO_GTE_1_7) - self.assertTrue(not versions.DJANGO_GTE_1_8) - self.assertTrue(not versions.DJANGO_GTE_1_9) - - @log_info - @mock.patch('django.get_version', mock.MagicMock(return_value='1.8.a1')) - def test_django_1_8_a1(self): - """ - Tests as if we were using Django==1.8.a1. - """ - from nine import versions - reload(versions) - - # Exact version matching - self.assertTrue(not versions.DJANGO_1_4) - self.assertTrue(not versions.DJANGO_1_5) - self.assertTrue(not versions.DJANGO_1_6) - self.assertTrue(not versions.DJANGO_1_7) - self.assertTrue(versions.DJANGO_1_8) - self.assertTrue(not versions.DJANGO_1_9) - - # Less than or equal matching - self.assertTrue(not versions.DJANGO_LTE_1_4) - self.assertTrue(not versions.DJANGO_LTE_1_5) - self.assertTrue(not versions.DJANGO_LTE_1_6) - self.assertTrue(not versions.DJANGO_LTE_1_7) - self.assertTrue(versions.DJANGO_LTE_1_8) - self.assertTrue(versions.DJANGO_LTE_1_9) - - # Greater than or equal matching - self.assertTrue(versions.DJANGO_GTE_1_4) - self.assertTrue(versions.DJANGO_GTE_1_5) - self.assertTrue(versions.DJANGO_GTE_1_6) - self.assertTrue(versions.DJANGO_GTE_1_7) - self.assertTrue(versions.DJANGO_GTE_1_8) - self.assertTrue(not versions.DJANGO_GTE_1_9) - - @log_info - @mock.patch('django.get_version', mock.MagicMock(return_value='1.10')) - def test_django_1_10(self): - """ - Tests as if we were using Django==1.10. - """ - from nine import versions - reload(versions) - - # Exact version matching - self.assertTrue(not versions.DJANGO_1_4) - self.assertTrue(not versions.DJANGO_1_5) - self.assertTrue(not versions.DJANGO_1_6) - self.assertTrue(not versions.DJANGO_1_7) - self.assertTrue(not versions.DJANGO_1_8) - self.assertTrue(not versions.DJANGO_1_9) - self.assertTrue(versions.DJANGO_1_10) - - # Less than or equal matching - self.assertTrue(not versions.DJANGO_LTE_1_4) - self.assertTrue(not versions.DJANGO_LTE_1_5) - self.assertTrue(not versions.DJANGO_LTE_1_6) - self.assertTrue(not versions.DJANGO_LTE_1_7) - self.assertTrue(not versions.DJANGO_LTE_1_8) - self.assertTrue(not versions.DJANGO_LTE_1_9) - - # Greater than or equal matching - self.assertTrue(versions.DJANGO_GTE_1_4) - self.assertTrue(versions.DJANGO_GTE_1_5) - self.assertTrue(versions.DJANGO_GTE_1_6) - self.assertTrue(versions.DJANGO_GTE_1_7) - self.assertTrue(versions.DJANGO_GTE_1_8) - self.assertTrue(versions.DJANGO_GTE_1_9) - self.assertTrue(versions.DJANGO_GTE_1_10) - - -if __name__ == "__main__": - unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/nine/user.py new/django-nine-0.2.2/src/nine/user.py --- old/django-nine-0.1.13/src/nine/user.py 2017-02-09 22:54:43.000000000 +0100 +++ new/django-nine-0.2.2/src/nine/user.py 2019-05-19 19:14:45.000000000 +0200 @@ -1,43 +1,15 @@ -""" -Compatibility module for safe and sane User model import. -""" +import warnings -import importlib +from django_nine.user import * # NOQA -from django.conf import settings -from django.core.exceptions import ImproperlyConfigured -from .versions import DJANGO_LTE_1_4, DJANGO_LTE_1_6, DJANGO_GTE_1_7 +warnings.warn( + "The `nine` namespace is deprecated, use `django_nine` instead.", + DeprecationWarning +) -if DJANGO_LTE_1_4: - from django.contrib.auth.models import User -else: - # Cannot use contrib.auth.get_user_model() at compile time. - user_app_name, user_model_name = settings.AUTH_USER_MODEL.rsplit('.', 1) - User = None - - if DJANGO_LTE_1_6: - for app in settings.INSTALLED_APPS: - if app.endswith(user_app_name): - user_app_models = importlib.import_module(app + ".models") - User = getattr(user_app_models, user_model_name) - break - elif DJANGO_GTE_1_7: - from django.apps import apps - try: - User = apps.get_registered_model(user_app_name, user_model_name) - except KeyError: - pass - - if User is None: - raise ImproperlyConfigured( - "You have defined a custom user model {0}, but the app {1} is " - "not in ``settings.INSTALLED_APPS``" - "".format(settings.AUTH_USER_MODEL, user_app_name) - ) - -__title__ = 'nine.user' -__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>' -__copyright__ = 'Copyright (c) 2015-2017 Artur Barseghyan' -__license__ = 'GPL 2.0/LGPL 2.1' -__all__ = ('User',) +warnings.warn( + "The `django_nine.user` module is deprecated and will be removed in " + "version 0.3.", + DeprecationWarning +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-nine-0.1.13/src/nine/versions.py new/django-nine-0.2.2/src/nine/versions.py --- old/django-nine-0.1.13/src/nine/versions.py 2017-02-09 22:54:43.000000000 +0100 +++ new/django-nine-0.2.2/src/nine/versions.py 2019-05-19 19:14:37.000000000 +0200 @@ -1,81 +1,8 @@ -""" -Contains information about the current Django version in use, including (LTE -and GTE). -""" +import warnings -from distutils.version import LooseVersion +from django_nine.versions import * # NOQA -import django - -__title__ = 'nine.versions' -__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>' -__copyright__ = 'Copyright (c) 2015-2017 Artur Barseghyan' -__license__ = 'GPL 2.0/LGPL 2.1' -__all__ = [ - 'LOOSE_DJANGO_VERSION', 'LOOSE_DJANGO_MINOR_VERSION', -] - -LOOSE_DJANGO_VERSION = LooseVersion(django.get_version()) -LOOSE_DJANGO_MINOR_VERSION = LooseVersion( - '.'.join([str(i) for i in LOOSE_DJANGO_VERSION.version[0:2]]) -) - -# Loose versions -LOOSE_VERSIONS = ( - '1.4', '1.5', '1.6', '1.7', '1.8', '1.9', '1.10', '1.11', '2.0', '2.1', - '2.2', '3.0' +warnings.warn( + "The `nine` namespace is deprecated, use `django_nine` instead.", + DeprecationWarning ) - -for v in LOOSE_VERSIONS: - var_name = 'LOOSE_VERSION_{0}'.format(v.replace('.', '_')) - globals()[var_name] = LooseVersion(v) - __all__.append(var_name) - -# Exact versions -EXACT_VERSIONS = LOOSE_VERSIONS[:-1] - -for i, v in enumerate(EXACT_VERSIONS): - l_cur = globals()['LOOSE_VERSION_{0}' - ''.format(LOOSE_VERSIONS[i].replace('.', '_'))] - l_nxt = globals()['LOOSE_VERSION_{0}' - ''.format(LOOSE_VERSIONS[i+1].replace('.', '_'))] - var_name = 'DJANGO_{0}'.format(v.replace('.', '_')) - globals()[var_name] = (l_cur <= LOOSE_DJANGO_VERSION < l_nxt) - __all__.append(var_name) - -# LTE list -LTE_VERSIONS = LOOSE_VERSIONS[:-1] - -for i, v in enumerate(EXACT_VERSIONS): - l_cur = globals()['LOOSE_VERSION_{0}' - ''.format(LOOSE_VERSIONS[i].replace('.', '_'))] - var_name = 'DJANGO_LTE_{0}'.format(v.replace('.', '_')) - globals()[var_name] = (LOOSE_DJANGO_MINOR_VERSION <= l_cur) - __all__.append(var_name) - -# GTE list -GTE_VERSIONS = LOOSE_VERSIONS[:-1] - -for i, v in enumerate(EXACT_VERSIONS): - l_cur = globals()['LOOSE_VERSION_{0}' - ''.format(LOOSE_VERSIONS[i].replace('.', '_'))] - var_name = 'DJANGO_GTE_{0}'.format(v.replace('.', '_')) - globals()[var_name] = ( - LOOSE_DJANGO_MINOR_VERSION >= l_cur - ) - __all__.append(var_name) - -__all__ = tuple(__all__) - -# Clean up -try: - del l_cur - del l_nxt - del var_name - del i - del v -except NameError: - pass - -del LooseVersion -del django
participants (1)
-
root