diff --git a/app/scodoc/pe_view.py b/app/scodoc/pe_view.py
index a8f7007cdb..45c97acd65 100644
--- a/app/scodoc/pe_view.py
+++ b/app/scodoc/pe_view.py
@@ -170,6 +170,6 @@ def pe_view_sem_recap(
return send_file(
data,
mimetype="application/zip",
- download_name=jury.NOM_EXPORT_ZIP + ".zip",
+ download_name=scu.sanitize_filename(jury.NOM_EXPORT_ZIP + ".zip"),
as_attachment=True,
)
diff --git a/tools/demo/__init__.py b/tools/demo/__init__.py
deleted file mode 100644
index 00d9381def..0000000000
--- a/tools/demo/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-# Demo package
diff --git a/tools/demo/demo_reset_noms.py b/tools/fakeportal/demo_reset_noms.py
similarity index 98%
rename from tools/demo/demo_reset_noms.py
rename to tools/fakeportal/demo_reset_noms.py
index 8211f5bbab..d1f00cf35c 100755
--- a/tools/demo/demo_reset_noms.py
+++ b/tools/fakeportal/demo_reset_noms.py
@@ -15,7 +15,7 @@ import sys
import random
import psycopg2
-from .gen_nomprenoms import nomprenom
+from gen_nomprenoms import nomprenom
def usage():
diff --git a/tools/fakeportal/etud_template.xml b/tools/fakeportal/etud_template.xml
index 046b77a1ec..6b2f205109 100644
--- a/tools/fakeportal/etud_template.xml
+++ b/tools/fakeportal/etud_template.xml
@@ -22,9 +22,9 @@
N
true
- MEAUX
- 099
- Etranger
+ {ville_naissance}
+ {code_dep_naissance}
+ {libelle_dep_naissance}
01
1
N
diff --git a/tools/fakeportal/fakeportal.py b/tools/fakeportal/fakeportal.py
index ad119c07c7..7db85a7395 100755
--- a/tools/fakeportal/fakeportal.py
+++ b/tools/fakeportal/fakeportal.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
"""Simple fake HTTP serveur
emulating "Apogee" Web service
@@ -13,12 +13,14 @@ import socketserver
import sys
import time
-from tools.demo.gen_nomprenoms import nomprenom
+from gen_nomprenoms import nomprenom
+
+cur_dir = Path(os.path.abspath(__file__)).parent
# Etudiant avec tous les champs (USPN)
-ETUD_TEMPLATE_FULL = open("etud_template.xml").read()
+ETUD_TEMPLATE_FULL = open(cur_dir / "etud_template.xml").read()
# Etudiant avec seulement les champs requis
-ETUD_TEMPLATE_MINI = open("etud_minimal_template.xml").read()
+ETUD_TEMPLATE_MINI = open(cur_dir / "etud_minimal_template.xml").read()
ETUD_HEAD = """
"""
@@ -44,6 +46,10 @@ def make_random_etud(nip, etape=None, annee=None, template=ETUD_TEMPLATE_FULL):
etape=etape,
diplome=diplome,
annee=annee,
+ ville_naissance=random.choice(("Paris", "Berlin", "Londres", "")),
+ code_dep_naissance=random.choice(("75", "99", "89")),
+ libelle_dep_naissance="nom département",
+ # nomlycee=
)
return data
@@ -130,11 +136,8 @@ class MyHttpRequestHandler(http.server.SimpleHTTPRequestHandler):
return
-# Create an object of the above class
-handler_object = MyHttpRequestHandler
-
PORT = 8678
-my_server = socketserver.TCPServer(("", PORT), handler_object)
+my_server = socketserver.TCPServer(("", PORT), MyHttpRequestHandler)
if __name__ == "__main__":
# Start the server
diff --git a/tools/demo/gen_nomprenoms.py b/tools/fakeportal/gen_nomprenoms.py
similarity index 62%
rename from tools/demo/gen_nomprenoms.py
rename to tools/fakeportal/gen_nomprenoms.py
index 6ab8518861..bf4d412aae 100644
--- a/tools/demo/gen_nomprenoms.py
+++ b/tools/fakeportal/gen_nomprenoms.py
@@ -7,10 +7,16 @@ from pathlib import Path
cur_dir = Path(os.path.abspath(__file__)).parent
# Noms et prénoms les plus fréquents en France:
-NOMS = [x.strip() for x in open(cur_dir / "noms.txt").readlines()]
-PRENOMS_H = [x.strip() for x in open(cur_dir / "prenoms-h.txt").readlines()]
-PRENOMS_F = [x.strip() for x in open(cur_dir / "prenoms-f.txt").readlines()]
-PRENOMS_X = [x.strip() for x in open(cur_dir / "prenoms-x.txt").readlines()]
+NOMS = [x.strip() for x in open(cur_dir / "nomsprenoms" / "noms.txt").readlines()]
+PRENOMS_H = [
+ x.strip() for x in open(cur_dir / "nomsprenoms" / "prenoms-h.txt").readlines()
+]
+PRENOMS_F = [
+ x.strip() for x in open(cur_dir / "nomsprenoms" / "prenoms-f.txt").readlines()
+]
+PRENOMS_X = [
+ x.strip() for x in open(cur_dir / "nomsprenoms" / "prenoms-x.txt").readlines()
+]
def nomprenom(civilite):
diff --git a/tools/demo/noms.txt b/tools/fakeportal/nomsprenoms/noms.txt
similarity index 100%
rename from tools/demo/noms.txt
rename to tools/fakeportal/nomsprenoms/noms.txt
diff --git a/tools/demo/prenoms-f.txt b/tools/fakeportal/nomsprenoms/prenoms-f.txt
similarity index 100%
rename from tools/demo/prenoms-f.txt
rename to tools/fakeportal/nomsprenoms/prenoms-f.txt
diff --git a/tools/demo/prenoms-h.txt b/tools/fakeportal/nomsprenoms/prenoms-h.txt
similarity index 100%
rename from tools/demo/prenoms-h.txt
rename to tools/fakeportal/nomsprenoms/prenoms-h.txt
diff --git a/tools/demo/prenoms-x.txt b/tools/fakeportal/nomsprenoms/prenoms-x.txt
similarity index 100%
rename from tools/demo/prenoms-x.txt
rename to tools/fakeportal/nomsprenoms/prenoms-x.txt
diff --git a/tools/demo/prenoms.txt b/tools/fakeportal/nomsprenoms/prenoms.txt
similarity index 100%
rename from tools/demo/prenoms.txt
rename to tools/fakeportal/nomsprenoms/prenoms.txt