Revision ae3961c3
Added by Frédéric Péters over 8 years ago
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') |
Also available in: Unified diff
use slugify function from django (#6826)