0001-python3-use-django.utils.six.moves.reduce-31165.patch
src/authentic2/idp/saml/backend.py | ||
---|---|---|
6 | 6 |
from django.core.urlresolvers import reverse |
7 | 7 |
from django.template.loader import render_to_string |
8 | 8 |
from django.db.models import Q |
9 |
from django.utils import six |
|
9 | 10 |
from django.utils.six.moves.urllib.parse import quote |
10 | 11 | |
11 | 12 |
import authentic2.saml.models as models |
... | ... | |
53 | 54 |
q.filter( |
54 | 55 |
sp_options_policy__isnull=True, |
55 | 56 |
liberty_provider__entity_id__in=sessions_eids)) |
56 |
qs = reduce(operator.__or__, queries) |
|
57 |
qs = six.moves.reduce(operator.__or__, queries)
|
|
57 | 58 |
# do some prefetching |
58 | 59 |
qs = qs.prefetch_related('liberty_provider') |
59 | 60 |
qs = qs.select_related('sp_options_policy') |
src/authentic2/saml/common.py | ||
---|---|---|
10 | 10 |
from django.conf import settings |
11 | 11 |
from django.http import HttpResponseRedirect, Http404, HttpResponse |
12 | 12 |
from django.shortcuts import render |
13 |
from django.utils import six |
|
13 | 14 |
from django.utils.six.moves.urllib import parse as urlparse |
14 | 15 |
from django.core.exceptions import ValidationError |
15 | 16 | |
... | ... | |
570 | 571 |
'unable to parse SessionNotOnOrAfter value %s, will ' |
571 | 572 |
'use default value for session length.', value) |
572 | 573 |
if session_not_on_or_afters: |
573 |
return reduce(min, session_not_on_or_afters) |
|
574 |
return six.moves.reduce(min, session_not_on_or_afters)
|
|
574 | 575 |
return None |
src/django_rbac/backends.py | ||
---|---|---|
3 | 3 |
from django.conf import settings |
4 | 4 |
from django.contrib.contenttypes.models import ContentType |
5 | 5 |
from django.db.models.query import Q |
6 |
from django.utils import six |
|
6 | 7 | |
7 | 8 |
try: |
8 | 9 |
from django.core.exceptions import FieldDoesNotExist |
... | ... | |
194 | 195 |
ct_id, fk = key.split('.') |
195 | 196 |
q.append(Q(pk=int(fk))) |
196 | 197 |
if q: |
197 |
return reduce(Q.__or__, q) |
|
198 |
return six.moves.reduce(Q.__or__, q)
|
|
198 | 199 |
return False |
199 | 200 | |
200 | 201 |
def filter_by_perm(self, user_obj, perm_or_perms, qs): |
src/django_rbac/managers.py | ||
---|---|---|
6 | 6 |
from django.contrib.contenttypes.models import ContentType |
7 | 7 |
from django.db.models.query import Q, Prefetch |
8 | 8 |
from django.contrib.auth import get_user_model |
9 |
from django.utils import six |
|
9 | 10 | |
10 | 11 |
from . import utils |
11 | 12 | |
... | ... | |
209 | 210 |
obsolete = old - add |
210 | 211 |
if obsolete: |
211 | 212 |
queries = (query.Q(parent_id=a, child_id=b, direct=False) for a, b in obsolete) |
212 |
self.model.objects.filter(reduce(query.Q.__or__, queries)).delete() |
|
213 |
self.model.objects.filter(six.moves.reduce(query.Q.__or__, queries)).delete()
|
|
213 | 214 | |
214 | 215 | |
215 | 216 |
@contextlib.contextmanager |
src/django_rbac/models.py | ||
---|---|---|
1 | 1 |
import operator |
2 | 2 |
import hashlib |
3 | 3 | |
4 |
from django.utils import six |
|
4 | 5 |
from django.utils.text import slugify |
5 | 6 |
from django.utils.translation import ugettext_lazy as _ |
6 | 7 |
from django.db import models |
... | ... | |
372 | 373 |
if hasattr(backend, "filter_by_perm"): |
373 | 374 |
results.append(backend.filter_by_perm(self, perm_or_perms, qs)) |
374 | 375 |
if results: |
375 |
return reduce(operator.__or__, results) |
|
376 |
return six.moves.reduce(operator.__or__, results)
|
|
376 | 377 |
else: |
377 | 378 |
return qs |
378 | 379 | |
379 |
- |