Révision ce10bca3
Ajouté par Thomas Noël il y a plus de 9 ans
usr/local/univnautes/sp/sp/update_federations.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 |
# |
|
3 |
# UnivNautes |
|
4 |
# Copyright (C) 2014 Entr'ouvert |
|
5 |
# |
|
6 |
# This program is free software: you can redistribute it and/or modify it under |
|
7 |
# the terms of the GNU Affero General Public License as published by the Free |
|
8 |
# Software Foundation, either version 3 of the License, or (at your option) any |
|
9 |
# later version. |
|
10 |
# |
|
11 |
# This program is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
|
14 |
# details. |
|
15 |
# |
|
16 |
# You should have received a copy of the GNU Affero General Public License |
|
17 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
18 |
|
|
19 |
# django init |
|
20 |
import os |
|
21 |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") |
|
22 |
|
|
23 |
import sys |
|
24 |
import pfconfigxml |
|
25 |
import urllib2 |
|
26 |
import json |
|
27 |
import math |
|
28 |
|
|
29 |
from django.db.models import Count |
|
30 |
from authentic2.saml.models import LibertyProvider |
|
31 |
|
|
32 |
import logging |
|
33 |
from logging.handlers import SysLogHandler |
|
34 |
|
|
35 |
logger = logging.getLogger() |
|
36 |
logger.setLevel(logging.INFO) |
|
37 |
syslog = SysLogHandler(address='/var/run/log', facility='local4') |
|
38 |
formatter = logging.Formatter('sp/geo[%(process)s] (%(levelname)s) %(message)s') |
|
39 |
syslog.setFormatter(formatter) |
|
40 |
logger.addHandler(syslog) |
|
41 |
|
|
42 |
for idp in LibertyProvider.objects.values('federation_source').annotate(Count("id")).order_by(): |
|
43 |
print idp |
|
44 |
|
Formats disponibles : Unified diff
remove useless file