mrunge pushed to python-django-openstack-auth (f22). "Replace AnonymousUser with AbstractUser (..more)"

notifications at fedoraproject.org notifications at fedoraproject.org
Tue Apr 14 19:04:24 UTC 2015


>From 4a37f121f01560866346bf808d1adb5fd535dad2 Mon Sep 17 00:00:00 2001
From: Matthias Runge <mrunge at redhat.com>
Date: Tue, 14 Apr 2015 14:31:56 +0200
Subject: Replace AnonymousUser with AbstractUser

Make d-o-a ready for django-1.8, though tests
are failing yet.

diff --git a/.gitignore b/.gitignore
index 0b6a2ac..e0d0577 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,4 @@
 /django_openstack_auth-1.1.6.tar.gz
 /django_openstack_auth-1.1.7.tar.gz
 /django_openstack_auth-1.1.9.tar.gz
+/django_openstack_auth-1.2.0.tar.gz
diff --git a/0002-Replace-AnonymousUser-with-AbstractUser.patch b/0002-Replace-AnonymousUser-with-AbstractUser.patch
new file mode 100644
index 0000000..72fe4f7
--- /dev/null
+++ b/0002-Replace-AnonymousUser-with-AbstractUser.patch
@@ -0,0 +1,77 @@
+From 80a45e04fa63e58a1ffd2b78500c2de84ed0354d Mon Sep 17 00:00:00 2001
+From: Matthias Runge <mrunge at redhat.com>
+Date: Thu, 26 Mar 2015 14:04:18 +0100
+Subject: [PATCH] Replace AnonymousUser with AbstractUser
+
+Django-1.8 added _meta classes for User models,
+which aren't supported by AnonymousUsers.
+
+SimpleTest has been deprecated since Django-1.6 and
+was now removed.
+
+Partially Implements: blueprint django18
+
+Change-Id: Ie243fd2304421694023f579f49f8fa201e761ba3
+---
+ openstack_auth/tests/run_tests.py | 10 ++++++++--
+ openstack_auth/user.py            |  5 +++--
+ 2 files changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/openstack_auth/tests/run_tests.py b/openstack_auth/tests/run_tests.py
+index 32ec848..dbb7c8a 100644
+--- a/openstack_auth/tests/run_tests.py
++++ b/openstack_auth/tests/run_tests.py
+@@ -20,7 +20,10 @@ import sys
+ os.environ['DJANGO_SETTINGS_MODULE'] = 'openstack_auth.tests.settings'
+ 
+ import django
+-from django.test import simple as test_simple
++if django.VERSION < (1, 8, 0):
++    from django.test import simple as test_simple
++else:
++    from django.test import runner
+ 
+ if hasattr(django, 'setup'):
+     django.setup()
+@@ -35,7 +38,10 @@ def run(*test_args):
+         "..",
+     )
+     sys.path.insert(0, parent)
+-    failures = test_simple.DjangoTestSuiteRunner().run_tests(test_args)
++    if django.VERSION < (1, 8, 0):
++        failures = test_simple.DjangoTestSuiteRunner().run_tests(test_args)
++    else:
++        failures = runner.DiscoverRunner(test_args)
+     sys.exit(failures)
+ 
+ 
+diff --git a/openstack_auth/user.py b/openstack_auth/user.py
+index 811fe84..ca0c852 100644
+--- a/openstack_auth/user.py
++++ b/openstack_auth/user.py
+@@ -116,7 +116,7 @@ class Token(object):
+         self.serviceCatalog = auth_ref.service_catalog.get_data()
+ 
+ 
+-class User(models.AnonymousUser):
++class User(models.AbstractUser):
+     """A User class with some extra special sauce for Keystone.
+ 
+     In addition to the standard Django user attributes, this class also has
+@@ -190,7 +190,7 @@ class User(models.AnonymousUser):
+                  services_region=None, user_domain_id=None,
+                  user_domain_name=None, domain_id=None, domain_name=None,
+                  project_id=None, project_name=None,
+-                 is_federated=False, unscoped_token=None):
++                 is_federated=False, unscoped_token=None, password=None):
+         self.id = id
+         self.pk = id
+         self.token = token
+@@ -215,6 +215,7 @@ class User(models.AnonymousUser):
+         # Unscoped token is used for listing user's project that works
+         # for both federated and keystone user.
+         self.unscoped_token = unscoped_token
++        self.password = None
+ 
+         # List of variables to be deprecated.
+         self.tenant_id = self.project_id
diff --git a/python-django-openstack-auth.spec b/python-django-openstack-auth.spec
index 25270ec..0b3464f 100644
--- a/python-django-openstack-auth.spec
+++ b/python-django-openstack-auth.spec
@@ -13,6 +13,7 @@ Source0:        http://pypi.python.org/packages/source/d/%{pypi_name}/%{pypi_nam
 # patches_base=1.2.0
 #
 Patch0001: 0001-remove-runtime-dep-to-python-pbr.patch
+Patch0002: 0002-Replace-AnonymousUser-with-AbstractUser.patch
 
 BuildArch:      noarch
 
@@ -46,6 +47,7 @@ Keystone V2 API.
 %setup -q -n %{pypi_name}-%{version}
 
 %patch0001 -p1
+%patch0002 -p1
 
 # Remove bundled egg-info
 rm -rf %{pypi_name}.egg-info
@@ -107,12 +109,14 @@ rm -rf %{buildroot}/%{python_sitelib}/openstack_auth/tests
 %dir %{python_sitelib}/openstack_auth/locale/??_??/LC_MESSAGES
 %{python_sitelib}/openstack_auth/*.py*
 %{python_sitelib}/openstack_auth/openstack
+%{python_sitelib}/openstack_auth/plugin
 %{python_sitelib}/openstack_auth/locale/openstack_auth.pot
 %{python_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
 
 %changelog
 * Tue Apr 14 2015 Matthias Runge <mrunge at redhat.com> - 1.2.0-1
 - rebase to 1.2.0
+- Use AbstractUser instead of AnonymousUser
 
 * Wed Feb 04 2015 Matthias Runge <mrunge at redhat.com> - 1.1.9-1
 - rebase to 1.1.9 (rhbz#1145024)
diff --git a/sources b/sources
index f86afc8..ff9be68 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-a201c7efbf552042f0bae64814454162  django_openstack_auth-1.1.9.tar.gz
+204d8b1f752983e77f95f73b5b4c834e  django_openstack_auth-1.2.0.tar.gz
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/python-django-openstack-auth.git/commit/?h=f22&id=4a37f121f01560866346bf808d1adb5fd535dad2


More information about the scm-commits mailing list