Forum : refonte visuelle (sujets en cartes, extraits, sections Bulletin/Sujets/Stations, nouveau sujet visible, polices locales)
Refonte de Codex (interrompue par son quota), reprise et finie par Claude : dates en français à l'heure de Paris, « Aucune réponse » / « Aucune publication ». 69 tests OK. En essai sur le forum LAN :32, pas en ligne. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cette révision appartient à :
1 Parent
3f1e1621a3
révision
72ab04d722
7 fichiers modifiés
+280
-71
Aucun fichier ne correspond à votre recherche
+17
-9
@@ -256,18 +256,26 @@ class Forum:
|
||||
raise Invalide("%s vide ou trop long" % nom)
|
||||
return s
|
||||
|
||||
def _nouveau_sujet(self, user, titre, corps, ip, status="publie", station=None):
|
||||
cur = self.con.execute("INSERT INTO topics(title, author_id, status, station) VALUES (?, ?, ?, ?)",
|
||||
(titre, user["id"], status, station))
|
||||
post = self.con.execute("INSERT INTO posts(topic_id, author_id, body, ip) VALUES (?, ?, ?, ?)",
|
||||
(cur.lastrowid, user["id"], corps, ip))
|
||||
self.con.commit()
|
||||
def _nouveau_sujet(self, user, titre, corps, ip, status="publie", station=None, prets=()):
|
||||
# Les fichiers sont deja valides ; aucune publication partielle si le
|
||||
# stockage echoue. Des fichiers sans reference peuvent rester sur disque.
|
||||
with self.con:
|
||||
cur = self.con.execute("INSERT INTO topics(title, author_id, status, station) VALUES (?, ?, ?, ?)",
|
||||
(titre, user["id"], status, station))
|
||||
post = self.con.execute("INSERT INTO posts(topic_id, author_id, body, ip) VALUES (?, ?, ?, ?)",
|
||||
(cur.lastrowid, user["id"], corps, ip))
|
||||
for nom, mime, propre in prets:
|
||||
empreinte, chemin = self._stocker(self.dossier_photos, mime, propre)
|
||||
self.con.execute("INSERT INTO attachments(post_id, filename, mime, size, sha256, stored_path) VALUES (?, ?, ?, ?, ?, ?)",
|
||||
(post.lastrowid, nom, mime, len(propre), empreinte, chemin))
|
||||
return cur.lastrowid, post.lastrowid
|
||||
|
||||
def creer_sujet(self, user, titre, corps, ip=None):
|
||||
"""Adhérents et propriétaires (un membre écrit seulement dans les sujets existants)."""
|
||||
def creer_sujet(self, user, titre, corps, ip=None, fichiers=()):
|
||||
"""Adherents et proprietaires ; photos validees avant creation du sujet."""
|
||||
self._exiger(user, "creer_sujet")
|
||||
return self._nouveau_sujet(user, self._texte(titre, TITRE_MAX, "titre"), self._texte(corps, CORPS_MAX, "message"), ip)[0]
|
||||
titre, corps = self._texte(titre, TITRE_MAX, "titre"), self._texte(corps, CORPS_MAX, "message")
|
||||
prets = self._preparer_photos(list(fichiers), illimite=self._peut(user, "photos_illimitees")) if fichiers else []
|
||||
return self._nouveau_sujet(user, titre, corps, ip, prets=prets)[0]
|
||||
|
||||
def creer_sujet_station(self, user, station, corps, ip=None):
|
||||
"""Propriétaire de station : un seul sujet pour sa station, titre préconfiguré, à valider."""
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur