Révision d02f08dc
Ajouté par Thomas Noël il y a plus de 9 ans
usr/local/univnautes/sp/sp/management/commands/configxml.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 |
from django.core.management.base import BaseCommand, CommandError |
|
20 |
import os |
|
21 |
from sp import pfconfigxml |
|
22 |
|
|
23 |
def get(key): |
|
24 |
if key == 'cpnames': |
|
25 |
for n in pfconfigxml.get_saml_cps(): |
|
26 |
print n['name'] |
|
27 |
|
|
28 |
class Command(BaseCommand): |
|
29 |
help = 'get infos from config.xml' |
|
30 |
|
|
31 |
def handle(self, *args, **options): |
|
32 |
try: |
|
33 |
action, key = args[0], args[1] |
|
34 |
except IndexError: |
|
35 |
print "syntax: configxml get|set key" |
|
36 |
return |
|
37 |
if action == 'get': |
|
38 |
return get(key) |
|
39 |
|
Formats disponibles : Unified diff
add manage configxml