Révision 80f5b222
Ajouté par Thomas Noël il y a plus de 9 ans
usr/local/univnautes/sp/sp/pfconfigxml.py | ||
---|---|---|
16 | 16 |
# You should have received a copy of the GNU Affero General Public License |
17 | 17 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | 18 |
|
19 |
import os |
|
19 | 20 |
import sys |
20 | 21 |
import re |
21 | 22 |
import xml.etree.ElementTree as ET |
22 | 23 |
from operator import itemgetter |
23 | 24 |
|
24 |
CONFIG_XML='/cf/conf/config.xml'
|
|
25 |
from django.conf import settings
|
|
25 | 26 |
|
26 | 27 |
def root(): |
27 |
with open(CONFIG_XML,'r') as f: |
|
28 |
with open(settings.CONFIG_XML,'r') as f:
|
|
28 | 29 |
x = ET.fromstring(f.read()) |
29 | 30 |
return x |
30 | 31 |
|
... | ... | |
157 | 158 |
}, |
158 | 159 |
} |
159 | 160 |
|
160 |
if __name__ == '__main__': |
|
161 |
if len(sys.argv) > 1: |
|
162 |
CONFIG_XML = sys.argv[1] |
|
163 |
print 'read config from', CONFIG_XML |
|
164 |
#print root() |
|
165 |
#print get_ca('53a4638d45954') |
|
166 |
#print get_cert('53a4644d846a4') |
|
167 |
#print get_saml_cps() |
|
168 |
#print get_sp() |
|
169 |
|
|
170 |
|
Formats disponibles : Unified diff
get CONFIG_XML path from settings or os.environ