Projet

Général

Profil

« Précédent | Suivant » 

Révision ae3961c3

Ajouté par Frédéric Péters il y a environ 9 ans

use slugify function from django (#6826)

Voir les différences:

requirements.txt
3 3
python-ldap
4 4
gadjo
5 5
requests
6
unidecode
setup.py
76 76
                      'python-ldap',
77 77
                      'gadjo',
78 78
                      'requests',
79
                      'unidecode'
80 79
    ],
81 80
    zip_safe=False,
82 81
    cmdclass={
uauth/organization/management/commands/sync_federations.py
5 5
import requests
6 6
import urlparse
7 7
import re
8
import unidecode
9 8
import lasso
10 9

  
11 10
from django.conf import settings
12 11
from django.core.management.base import BaseCommand, CommandError
12
from django.utils.text import slugify
13 13

  
14 14
def md_element_name(tag_name):
15 15
    return '{%s}%s' % (lasso.SAML2_METADATA_HREF, tag_name)
......
17 17
def mdui_element_name(tag_name):
18 18
    return '{%s}%s' % (SAML2_METADATA_UI_HREF, tag_name)
19 19

  
20
def slugify(text):
21
    text = unidecode.unidecode(text).lower()
22
    return re.sub(r'\W+', '-', text)
23

  
24 20
SAML2_METADATA_UI_HREF = 'urn:oasis:names:tc:SAML:metadata:ui'
25 21
ENTITY_DESCRIPTOR_TN = md_element_name('EntityDescriptor')
26 22
ENTITIES_DESCRIPTOR_TN = md_element_name('EntitiesDescriptor')

Formats disponibles : Unified diff