Skip to content

Marmotte/respit feature#1415

Open
marmotteabbas wants to merge 24 commits intoEsupPortail:dev_v4from
marmotteabbas:marmotte/respit_feature
Open

Marmotte/respit feature#1415
marmotteabbas wants to merge 24 commits intoEsupPortail:dev_v4from
marmotteabbas:marmotte/respit_feature

Conversation

@marmotteabbas
Copy link
Copy Markdown
Collaborator

Dev from Grenoble University about the archive and the respit calculator system.
Author : Florent Paccalet
Mail : florent.paccalet@univ-grenoble-alpes.fr

@Badatos Badatos added this to the 4.x milestone Mar 18, 2026
@Badatos
Copy link
Copy Markdown
Collaborator

Badatos commented Mar 18, 2026

Merci pour cette PR !
Pour que le code soit conforme, je t'invite à d'abord lancer la commande make pystyle pour t'assurer que les fichiers respectent les recommandations flake8 ;)

@marmotteabbas
Copy link
Copy Markdown
Collaborator Author

Très bien.
Je dois aussi intégrer un .env.dev au commit c'est bien ça ?

@Badatos
Copy link
Copy Markdown
Collaborator

Badatos commented Mar 18, 2026

Très bien. Je dois aussi intégrer un .env.dev au commit c'est bien ça ?

non, pas de .env.dev nécessaire à priori.

Copy link
Copy Markdown
Collaborator

@Badatos Badatos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Voici déjà quelques corrections à apporter aux chaines i18n

Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
Comment thread pod/locale/fr/LC_MESSAGES/django.po
Comment thread pod/main/configuration.json Outdated
Comment thread pod/main/configuration.json Outdated
Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
msgstr "Ce service n'est pas accessible."

msgid "Link to the video :"
msgstr "Lien vers la vidéo :"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En fait, avant chaque double-point (ainsi que pour les point-virgule, point d'exclamation, point d'interrogation), il faut un espace insécable en français. (un espace qui ne sera jamais coupé en fin de ligne).

  • Sur MacOS par exemple, pour taper un espace insécable, on fait ALT+espace
  • Sur Windows, ça doit se faire avec le raccourci Alt+255

Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
msgstr "Ce service n'est pas accessible."

msgid "Link to the video :"
msgstr "Lien vers la vidéo :"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L'autre solution est de trouver un espace insécable ailleurs dans le fichier, et de le copier/coller ;)

Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
msgstr "Ce service n'est pas accessible."

msgid "Link to the video :"
msgstr "Lien vers la vidéo :"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visuellement, il est quasi impossible de distinguer un espace normal d'un espace insécable. Pour les distinguer plus facilement, je vous invite à activer une option dans votre éditeur de texte qui permet de mieux les visualiser.
Sur l'éditeur VS Code par exemple, cela se fait avec le plugin https://marketplace.visualstudio.com/items?itemName=possan.nbsp-vscode
=> les espaces insécables apparaissent alors sur fond rouge, ce qui permet de les distinguer rapidement.

@marmotteabbas
Copy link
Copy Markdown
Collaborator Author

marmotteabbas commented Mar 25, 2026

make pystyle

Je ne parviens pas à lance "make pystyle"

root@pod:/usr/src/app# make pystyle
black . -l 90
make: black: No such file or directory
make: *** [Makefile:86: pystyle] Error 127

A quelle niveau le lancer ? Y'a t'il une procédure particulière ? J'ai lancé l'installation dans le conteneur en faisant "pip install pystyle" au préalable.

Je lance la commande "flake8" seul, j'ai tout un tas d'erreur d'écriture que je peux corriger, ça suffit ?

Merci !

@Badatos
Copy link
Copy Markdown
Collaborator

Badatos commented Mar 25, 2026

make pystyle

Je ne parviens pas à lance "make pystyle"

root@pod:/usr/src/app# make pystyle black . -l 90 make: black: No such file or directory make: *** [Makefile:86: pystyle] Error 127

A quelle niveau le lancer ? Y'a t'il une procédure particulière ? J'ai lancé l'installation dans le conteneur en faisant "pip install pystyle" au préalable.

Je lance la commande "flake8" seul, j'ai tout un tas d'erreur d'écriture que je peux corriger, ça suffit ?

Merci !

En fait, il faut préalablement avoir installé la commande black :

pip install black

C'est notre faute, c'est vrai qu'on aurait du le mettre dans le requiremets-dev.txt

Tu peux en effet corriger à la main ce que te signale flake8, mais black en corrige une bonne partie tout seul, ce serait bête de tout se coltiner ^^.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,
Merci beaucoup pour tout ce travail.
Voici mes quelques remarques :

  • répis -> répit
  • si possible, mettre les commentaires en Anglais également
  • la version init devrait être la 4.3.0 maintenant

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vu

@marmotteabbas
Copy link
Copy Markdown
Collaborator Author

make pystyle

Je ne parviens pas à lance "make pystyle"
root@pod:/usr/src/app# make pystyle black . -l 90 make: black: No such file or directory make: *** [Makefile:86: pystyle] Error 127
A quelle niveau le lancer ? Y'a t'il une procédure particulière ? J'ai lancé l'installation dans le conteneur en faisant "pip install pystyle" au préalable.
Je lance la commande "flake8" seul, j'ai tout un tas d'erreur d'écriture que je peux corriger, ça suffit ?
Merci !

En fait, il faut préalablement avoir installé la commande black :

pip install black

C'est notre faute, c'est vrai qu'on aurait du le mettre dans le requiremets-dev.txt

Tu peux en effet corriger à la main ce que te signale flake8, mais black en corrige une bonne partie tout seul, ce serait bête de tout se coltiner ^^.

Ok je fais ça ! J'avais en effet commencer à tout faire à la main ^^

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

un petit détail : il me semble qu'il faut un espace après # pour les commentaires

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vu

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Commentaires avec #, mais pas en début de lignes
  • Les messages doivent être en Anglais avec utilisation de la traduction _()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vu

Comment thread pod/video/management/commands/create_archive_package.py Outdated
path = os.path.join(mediaPackage_dir, "")
shutil.rmtree(path)

return "/media/video_package/"+vid.slug+".zip" No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ne faudrait il pas utiliser settings.MEDIA_ROOT plutôt que /media en dur ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je n'ai trouvé aucune déclaration dans le settings. Ne sachant pas comment cela serait déclaré par les uns et les autres j'ai préféré assuré pour avoir de manière certaine "/media/video_package/" qui est le chemin que je veux avoir dans tout les cas. De plus une déclaration de MEDIA_ROOT peut influencer tout le logiciel ou une déclaration en dur ici m'assure avec certitude le chemin sans avoir de lien avec le reste pod avec lequel cette brique n'a rien à voir.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dans ce cas, alors ptet ajouter un parametrage "ARCHIVE_ROOT" que chacun pourra configurer en fonction de son arborescence ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi utiliser des requêtes SQL ?
Je pense qu'il est préférable d'utiliser directement les objets via Video.objects.filter()... par exemple.
J'imagine qu'il doit y avoir un problème de complexité via flake; il faudra sûrement refactoriser.

Copy link
Copy Markdown
Collaborator Author

@marmotteabbas marmotteabbas Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus facile à écrire, infiniment moins de trucs tordus à effectuer pour utiliser SUBSTRING, et oui flake. Je reste la dessus apriori.

Copy link
Copy Markdown
Collaborator Author

@marmotteabbas marmotteabbas Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LoicBonavent Est ce que je peux VRAIMENT pas garder les requêtes SQL ? Ca me force à repenser beaucoup de chose, je peux laisser ça comme ça ? Ou partiellement comme ça ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, le fait de passer par des requêtes SQL pose potentiellement des problèmes de sécurité (typiquement des injections SQL). Mais si c'est géré et que tu es plus à l'aise avec des requêtes SQL, pas de soucis pour ma part.
Peut-être partiellement : dans les cas simples, si c'est possible, utiliser le mapping ORM, sinon des requêtes SQL.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merci beaucoup !
On y a passé la journée avec Alice mais on a finalement tout enlevé pour passer par du requêtage ORM exclusivement ;)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, bien joué

Comment thread pod/video/forms.py
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attention, il y a du Français dans le code.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vu

Comment thread pod/video/views.py
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour les imports, tu peux utiliser l'extension isort; cela te fera des lignes d'import beaucoup plus propres

Comment thread pod/video/views.py
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Il y a du Français, dans le nom des actions.
  • Pourquoi garder du code commenté ? Ou alors dire s'il y a une utilité dans ce cas.
  • Manque peut-être des lints
  • Il faudrait aussi ajouter des docstrings pour les fonctions

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vu

@Badatos
Copy link
Copy Markdown
Collaborator

Badatos commented Mar 30, 2026

Il semble y avoir un souci avec la CI... :/

Container pod-back-with-volumes  Error
 Container pod-back-with-volumes  Error
 Container pod-back-with-volumes  Error
dependency failed to start: container pod-back-with-volumes is unhealthy

Copy link
Copy Markdown
Collaborator

@Badatos Badatos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suite des commentaires

Comment thread pod/locale/fr/LC_MESSAGES/django.po
Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
msgstr "Ce service n'est pas accessible."
msgstr "Ce service nest pas disponible."

msgid "Link to the video :"
Copy link
Copy Markdown
Collaborator

@Badatos Badatos Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jamais d'espace avant les signes de ponctuation double en anglais (link to the video:)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vu

Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
@@ -11453,15 +11451,15 @@ msgid "Video Archiving"
msgstr "Archivage Vidéo"

msgid "Are you sure you want to archive this video ?"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pas d'espace avant les signes de ponctuation doubles en anglais

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vu

path = os.path.join(mediaPackage_dir, "")
shutil.rmtree(path)

return "/media/video_package/"+vid.slug+".zip" No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dans ce cas, alors ptet ajouter un parametrage "ARCHIVE_ROOT" que chacun pourra configurer en fonction de son arborescence ?

Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated

#: pod/video/templates/videos/well_prolonged.html
msgid "The video life span was extended to"
msgstr "La vidéo est prolongé jusqu'au"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

il faut inclure les variables dans les chaines de caractères

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

et "prolongéE"

Comment thread pod/video/management/commands/respit_launcher.py
Comment thread pod/video/management/commands/respit_launcher.py
<legend>{% trans "Agreement required" %}</legend>
<div class="list-group-item">
<div class="form-group form-group-required ">
<div>{% trans "Are you sure you want to archive this video ?" %}</div>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pas d'espace avant les signes doubles en anglais

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vu

</a>
</div>

{% endblock page_content %} No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ajouter une ligne vide en fin de fichier

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment ça se fait que flake8 ne l'est pas vu c'est un comportement attendu ?
vu sinon

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flake8 ne regarde pas ca spécifiquement, c'est juste recommandé de toujours laisser une ligne vide en fin de fichier pour éviter des conflits sur un ajout ultérieur

{% trans "Return to homepage." %}
</a>
</div>
{% endblock page_content %} No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ligne vide

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vu

@marmotteabbas
Copy link
Copy Markdown
Collaborator Author

Il semble y avoir un souci avec la CI... :/

Container pod-back-with-volumes  Error
 Container pod-back-with-volumes  Error
 Container pod-back-with-volumes  Error
dependency failed to start: container pod-back-with-volumes is unhealthy

Je comprend pas trop ce que je dois faire avec tout ça ..

@Badatos
Copy link
Copy Markdown
Collaborator

Badatos commented Mar 31, 2026

Il semble y avoir un souci avec la CI... :/

Container pod-back-with-volumes  Error
 Container pod-back-with-volumes  Error
 Container pod-back-with-volumes  Error
dependency failed to start: container pod-back-with-volumes is unhealthy

Je comprend pas trop ce que je dois faire avec tout ça ..

Pour le moment, moi non plus. Est-ce que Pod tourne bien chez vous sur cette branche, y'a aucune erreur ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

à priori, le bug ne vient pas de la CI, puisqu'elle fonctionne sur les autres PR.
Il doit y a voir un truc dans les fichiers modifié dans cette PR même. Aucune erreur de votre coté en lancant Pod ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non aucune erreur en lançant POD dans docker avec la commande make docker-start
Tout baigne ... donc du coup je sais pas ..

@Badatos
Copy link
Copy Markdown
Collaborator

Badatos commented Mar 31, 2026

J'ai trouvé l'erreur.
Cela vient du from ..custom.settings_local import WARN_DEADLINES ajouté dans le video/views.py
En effet, par défaut ce parametre n'existe pas, et crée une erreur ImportError: cannot import name 'WARN_DEADLINES' from 'pod.custom.settings_local'

@Badatos
Copy link
Copy Markdown
Collaborator

Badatos commented Mar 31, 2026

J'ai trouvé l'erreur. Cela vient du from ..custom.settings_local import WARN_DEADLINES ajouté dans le video/views.py En effet, par défaut ce parametre n'existe pas, et crée une erreur ImportError: cannot import name 'WARN_DEADLINES' from 'pod.custom.settings_local'

à la place, il faudrait plutot un WARN_DEADLINES = getattr(settings, "WARN_DEADLINES", [60,30,7])

Comment thread pod/video/views.py Outdated
)

# from django.contrib.auth.hashers import check_password
from ..custom.settings_local import WARN_DEADLINES
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ici, il faudrait plutôt WARN_DEADLINES = getattr(settings, "WARN_DEADLINES", [60,30,7]) pour toujours avoir une valeur par défaut.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waaaaaaaaa c'est ça qui bloque ???? C'est ouf !!! Merci je vais retester ça ...

Copy link
Copy Markdown
Collaborator Author

@marmotteabbas marmotteabbas Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est passé mais Y'a juste eu une petite erreur à la fin de l'exec ... je sais pas trop ce que ça veut dire pour l'instant ..
Merci pour le debug en tout cas ça a grave aidé ;)

@Badatos
Copy link
Copy Markdown
Collaborator

Badatos commented Mar 31, 2026

On avance... cette fois, ce sont 2 erreurs flake8 :

./pod/video/views.py:128:57: E231 missing whitespace after ','
./pod/video/views.py:128:60: E231 missing whitespace after ','

(à priori, un coup de make pystyle devrait le régler tout seul)

@marmotteabbas marmotteabbas force-pushed the marmotte/respit_feature branch from d94deac to eac4a62 Compare April 7, 2026 14:15
Copy link
Copy Markdown
Collaborator

@Badatos Badatos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quelques corrections de textes :

Comment thread pod/video/management/commands/respit_launcher.py

from pod.playlist.models import Playlist

# https://docs.djangoproject.com/fr/6.0/howto/custom-management-commands/ python3 manage.py respit_launcher
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

la commande python est à retirer ce ce commentaire, et à placer dans le cartouche pydoc au début du fichier

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c'est retiré.
Vu



class Command(BaseCommand):
help = "Closes the specified poll for voting"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

à mon avis cette class n'a rien à voir avec un sondage (poll)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Très bonne remarque je sais pas ce que j'ai foutu.
vu

Comment thread pod/video/management/commands/respit_launcher.py
Comment thread pod/main/configuration.json
Comment thread pod/main/configuration.json
Comment thread pod/main/configuration.json Outdated
"default_value": false,
"description": {
"en": [
"Détermines if we enable a link send to take a decision about the futur of the concerned video during the reminder campaign sent by check_obsolete_video."
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enables sending a link to make a decision on the future of the video during the recall campaign instantiated by check_obsolete_video.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vu

Comment thread pod/main/configuration.json
Comment thread pod/main/configuration.json
Copy link
Copy Markdown
Collaborator

@Badatos Badatos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quelques remarques supplémentaires :

(nb: je n'ai pas encore fini la relecture, mais je préfère envoyer au fur et à mesure pour que tu ai le temps de corriger)

Comment thread pod/video/views.py Outdated
"""
###########################
# Calcul control access
###########################
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je pense que ce commentaire n'est pas utile et peut être retiré.

Comment thread pod/video/views.py Outdated
step_date = vid.date_delete - timedelta(days=higher_warn)
display_or_not = date.today() >= step_date
###########################
###########################
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commentaire à retirer

Comment thread pod/video/views.py
</form>
<a href="/video/archive/and/download/{{ video.slug }}/">{% trans "Export this video." %}</a>
{% else %}
<h1>{% trans "This service is not available." %}</h1>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ici, je pense qu'il faudrait distinguer 2 cas :

  • Quand ENABLE_PAGE_OBSO_MAIL == True, le message est en effet "This service is not available."
  • Mais quand display_or_not == False, le message devrait plutôt être This video is not close to its deletion date. si je comprend bien le cas.

Copy link
Copy Markdown
Collaborator Author

@marmotteabbas marmotteabbas Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Y'a le cas où on rend le service indisponible involontairement. La fois où il n'est pas dans une période de campagne de rappel OU qu'il a déjà rajouter du temps de répit par la prolongation (même critère).
Dans tout les cas, l'utilisateur n'a pas besoin et de ne doit pas savoir les conditions. C'est notre politique interne côté admin ça ne le regarde pas.

<form action="/video/valid/form/respit/{{ video.slug }}/" method="post">
{% csrf_token %}
{{ form }}
<input type="submit" value="Submit">
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attention "Submit" doit être traduit

{% block page_content %}
<div class="list-group">
<fieldset>
<legend>{% trans "Archive Download" %}</legend>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combien de temps cette archive sera-t-elle disponible ? Est-elle supprimée automatiquement au bout d'un temps sur le serveur ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non pas de suppression c'est une bonne remarque. Je dois mettre en place un cron pour le nettoyage ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je pense que tu peux juste proposer un script shell, et indiquer dans la doc qu'il est conseillé de le mettre en cron à telle fréquence.

Comment thread pod/video/management/commands/check_obsolete_videos.py Outdated
Comment thread pod/video/management/commands/check_obsolete_videos.py Outdated
Comment thread pod/video/views.py
"""
This function will launch a archive process and say if it has worked or not on an interface.
"""
if able_or_not_respit(slug) is True and ENABLE_PAGE_OBSO_MAIL:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attention, il manque un "else" ici, car une vue ne peut pas ne rien renvoyer.
Ici, il faudrait faire un return HttpResponseBadRequest() avec un message indiquant la raison

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vu

Comment thread pod/video/views.py
"""
This function will extend a video about RALLONGE_RESPIT_DAYS days and display the new delete_date.
"""
if able_or_not_respit(slug) is True and ENABLE_PAGE_OBSO_MAIL:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attention, il manque un "else" ici, car une vue ne peut pas ne rien renvoyer.
Ici, il faudrait faire un return HttpResponseBadRequest() avec un message indiquant la raison

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vu

@Badatos
Copy link
Copy Markdown
Collaborator

Badatos commented Apr 17, 2026

Attention, il y a une erreur dans le code :

Traceback (most recent call last):
  File "/home/runner/work/Esup-Pod/Esup-Pod/pod/video/tests/test_obsolescence.py", line 198, in test_delete_obsolete_video
    ) = cmd.get_video_archived_deleted_treatment()
  File "/home/runner/work/Esup-Pod/Esup-Pod/pod/video/management/commands/check_obsolete_videos.py", line 301, in get_video_archived_deleted_treatment
    self.write_in_csv(vid, "deleted")
AttributeError: 'Command' object has no attribute 'write_in_csv'

@Badatos
Copy link
Copy Markdown
Collaborator

Badatos commented Apr 20, 2026

Encore des soucis de flake8. Pense au make pystyle ;)

@marmotteabbas
Copy link
Copy Markdown
Collaborator Author

Encore des soucis de flake8. Pense au make pystyle ;)

Je suis trop bête j'avais oublié .. C'est corrigé ça devrait passer maintenant.

Copy link
Copy Markdown
Collaborator

@Badatos Badatos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quelques changement mineurs à appliquer sur les commentaires :


from datetime import date, timedelta

# from pod.custom.settings_local import ENABLE_PAGE_OBSO_MAIL
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ne pas laisser ce commentaire si ce n'est plus utilisé.

# date_deletion=vid.date_delete
# )
# vid_delete.video.add(vid)
# vid_delete.save()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ne pas conserver ce code s'il n'est plus utilisé.

data_to_add["date_delete"] = p.date_delete
data_to_add["description"] = p.description

# Nombre de chaines
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mettre les commentaires en anglais.


data_to_add["channel_count"] = nb_chaine

# Nombre de fois en favoris
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

Comment thread pod/video/tests/test_obsolescence.py Outdated
# Connecte l'utilisateur
self.client.force_login(self.user)

# Simule l'envoi du formulaire avec action Archive
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mettre les commentaires en anglais.

Comment thread pod/video/tests/test_obsolescence.py Outdated
response = self.client.post(
f"/video/respit/{self.video1.slug}/", {"action": "Extend"}
)
# Vérifie que le code HTTP est 200
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mettre les commentaires en anglais.

Comment thread pod/video/tests/test_obsolescence.py Outdated

# Simule l'envoi du formulaire avec action Archive
response = self.client.post(f"/video/go/prolong/{self.video1.slug}/")
# Vérifie que le code HTTP est 301
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mettre les commentaires en anglais.

Comment thread pod/video/tests/test_obsolescence.py Outdated

# Simule l'envoi du formulaire avec action Archive
response = self.client.post(f"/video/go/archive/{self.video1.slug}/")
# Vérifie que le code HTTP est 301
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mettre les commentaires en anglais.

Comment thread pod/video/views.py Outdated
action = request.POST["action"]
if (
action == "Delete"
): # Si l'utilisateur sélectionne l'action "supprimer" dans l'interface
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mettre les commentaires en anglais.

Comment thread pod/video/views.py
)
else:
raise Exception("Vous ne pouvez pas prolonger plus votre video")
print("")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception à mettre en anglais

Comment thread pod/locale/fr/LC_MESSAGES/django.po Outdated
msgstr "Cette interface vous permet d'indiquer vos préférences quant au futur de votre vidéo sur cette plateforme."

msgid "Select this option if you want to extend the publication of your video by %(rrd)s days."
msgstr "Choisissez cette option si vous souhaitez prolonger de %(rrd)s jours la publication de votre vidéo"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

il manque un point en fin de phrase

Comment thread pod/main/settings.py Outdated
PROLONGATION_GRANTED = False
DELETION_GRANTED = False
# flake8: noqa
RESPIT_MODEL_PARAMETERS = [] No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ajouter ligne vide en fin de fichier

Comment thread pod/main/settings.py Outdated
ENABLE_PAGE_OBSO_MAIL = False
PROLONGATION_GRANTED = False
DELETION_GRANTED = False
# flake8: noqa
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pourquoi ce noqa est-il présent ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour faire passer le flake8 du RESPIT_MODEL_PARAMETERS = [] qui n'est pas utilisé ici.
Celine m'a demandé l'ajouter ici en vu d'une utilisation futur.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alors il faut indiquer le code exact à ignorer par flake8, pour qu'il n'ignore pas toutes les règles.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je pensais que c'était ce que ça faisait, quelle est la ligne pour une ligne uniquement ?

Copy link
Copy Markdown
Collaborator

@Badatos Badatos Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ca dépend du code d'erreur que te fait Flake8
Par exemple, s'il te signale l'erreur "E731", tu mets ceci :
# noqa: E731

(car # flake8: noqa ignore tout le fichier 😨 )

@marmotteabbas
Copy link
Copy Markdown
Collaborator Author

@Badatos Tu peux m'éclairer sur la raison pour laquelle je me mange un "container pod-back-with-volumes is unhealthy" ?

@Badatos
Copy link
Copy Markdown
Collaborator

Badatos commented Apr 22, 2026

@Badatos Tu peux m'éclairer sur la raison pour laquelle je me mange un "container pod-back-with-volumes is unhealthy" ?

En général, c'est parce qu'il y a une erreur dans Pod qui l'empeche de démarrer

@Badatos
Copy link
Copy Markdown
Collaborator

Badatos commented May 2, 2026

Pas mal, on approche de la fusion :)

Il y a juqtes quelques lignes nouvelles qui ne sont pas couvertes par les tests unitaires, notamment dans video/utils.py, où les fonction suivantes mériteraient des tests :

  • check_csv_header
  • store_as_dublincore
  • read_archived_csv
  • export_complement
  • archive_pack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants