Projet

Général

Profil

0001-quiet-some-RemovedInDjango19Warning-warnings-25222.patch

Emmanuel Cazenave, 12 juillet 2018 18:48

Télécharger (4,35 ko)

Voir les différences:

Subject: [PATCH] quiet some RemovedInDjango19Warning warnings (#25222)

 .../management/commands/cleanupauthentic.py   | 19 +++++++++----------
 .../management/commands/load-ldif.py          |  2 +-
 .../saml/management/commands/sync-metadata.py |  2 +-
 .../commands/oidc-register-issuer.py          |  2 +-
 .../management/commands/provision.py          |  2 +-
 5 files changed, 13 insertions(+), 14 deletions(-)
src/authentic2/idp/management/commands/cleanupauthentic.py
1 1
import logging
2 2

  
3
from django.apps import apps
3 4
from django.core.management.base import BaseCommand
4
from django.db import models
5

  
5 6

  
6 7
class Command(BaseCommand):
7 8
    help = 'Clean expired models of authentic2.'
8 9

  
9 10
    def handle(self, **options):
10 11
        log = logging.getLogger(__name__)
11

  
12
        for app in models.get_apps():
13
            for model in models.get_models(app):
12
        for app in apps.get_app_configs():
13
            for model in app.get_models():
14 14
                # only models from authentic2
15
                if not model.__module__.startswith('authentic2'):
16
                    continue
17
                try:
18
                    self.cleanup_model(model)
19
                except:
20
                    log.exception('cleanup of model %s failed', model)
15
                if model.__module__.startswith('authentic2'):
16
                    try:
17
                        self.cleanup_model(model)
18
                    except:
19
                        log.exception('cleanup of model %s failed', model)
21 20

  
22 21
    def cleanup_model(self, model):
23 22
        manager = getattr(model, 'objects', None)
src/authentic2/management/commands/load-ldif.py
97 97
class Command(BaseCommand):
98 98
    '''Load LDAP ldif file'''
99 99
    can_import_django_settings = True
100
    requires_model_validation = True
100
    requires_system_checks = True
101 101
    help = 'Load/update LDIF files as users'
102 102

  
103 103
    def add_arguments(self, parser):
src/authentic2/saml/management/commands/sync-metadata.py
225 225
    and LibertyIdentityProvider files'''
226 226
    can_import_django_settings = True
227 227
    output_transaction = True
228
    requires_model_validation = True
228
    requires_system_checks = True
229 229

  
230 230
    help = 'Load the specified SAMLv2 metadata file'
231 231

  
src/authentic2_auth_oidc/management/commands/oidc-register-issuer.py
15 15
class Command(BaseCommand):
16 16
    '''Load LDAP ldif file'''
17 17
    can_import_django_settings = True
18
    requires_model_validation = True
18
    requires_system_checks = True
19 19
    help = 'Register an OpenID Connect OP'
20 20

  
21 21
    def add_arguments(self, parser):
src/authentic2_provisionning_ldap/management/commands/provision.py
23 23
class Command(BaseCommand):
24 24
    can_import_django_settings = True
25 25
    output_transaction = True
26
    requires_model_validation = True
26
    requires_system_checks = True
27 27

  
28 28
    def add_arguments(self, parser):
29 29
        parser.add_argument('target_resource', nargs='*')
30
-