Skip to content

Commit

Permalink
+ Upgrade all py packages
Browse files Browse the repository at this point in the history
+ remove some ES deprecations
  • Loading branch information
Badatos committed Dec 2, 2024
1 parent 44a9a5b commit dfd0662
Show file tree
Hide file tree
Showing 26 changed files with 81 additions and 340 deletions.
2 changes: 1 addition & 1 deletion dockerfile-dev-with-volumes/pod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RUN mkdir /tmp/node_modules/
COPY --from=source-build-js /tmp/pod/node_modules/ /tmp/node_modules/

RUN pip3 install --no-cache-dir -r requirements-conteneur.txt \
&& pip3 install elasticsearch==8.9.0
&& pip3 install elasticsearch==8.16.0

# ENTRYPOINT:
COPY ./dockerfile-dev-with-volumes/pod/my-entrypoint.sh /tmp/my-entrypoint.sh
Expand Down
2 changes: 1 addition & 1 deletion pod/authentication/tests/test_populated.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def test_populate_user_from_entry_unpopulate_group(self) -> None:
)


@skip("# Esup-Pod 4.0 is no more comapible with Shibb (until someone correct this)")
@skip("# Esup-Pod 4.0 is no more compatible with Shibb (until someone correct this)")
class PopulatedShibTestCase(TestCase):
def setUp(self) -> None:
"""Set up PopulatedShibTestCase create user Pod."""
Expand Down
3 changes: 1 addition & 2 deletions pod/live/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.urls import path
from django.urls import re_path
from django.urls import path, re_path

from .pilotingInterface import ajax_get_mandatory_parameters
from .views import (
Expand Down
10 changes: 5 additions & 5 deletions pod/main/rest_router.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Esup-Pod Main REST api url router."""

from rest_framework import routers
from django.urls import include, path, re_path
from django.urls import include, path
from pod.authentication import rest_views as authentication_views
from pod.video import rest_views as video_views
# from pod.main import rest_views as main_views
Expand Down Expand Up @@ -106,13 +106,13 @@
auth_views.accessgroups_remove_users_by_name,
name="accessgroups_set_users_by_name",
),
re_path(
r"accessgroups_set_user_accessgroup /$",
path(
"accessgroups_set_user_accessgroup/",
auth_views.accessgroups_set_user_accessgroup,
name="accessgroups_set_user_accessgroup ",
),
re_path(
r"accessgroups_remove_user_accessgroup /$",
path(
"accessgroups_remove_user_accessgroup/",
auth_views.accessgroups_remove_user_accessgroup,
name="accessgroups_remove_user_accessgroup ",
),
Expand Down
2 changes: 1 addition & 1 deletion pod/main/templates/block/card_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="pod-inner edito-card-list" id="edito-videos-list-{{ uniq_id }}">
<h2>{{ title |capfirst|truncatechars:43 }}</h2>

{% if type == "video" %}
{% if type == "video" %}
{% include "videos/video_list.html" with videos=elements %}
{% elif type == "event" %}
{% include "live/events_list.html" with events=elements hide_counter=True %}
Expand Down
6 changes: 1 addition & 5 deletions pod/main/templates/maintenance.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load thumbnail %}
{% load video_filters %}
{% load video_tags %}
{% load i18n static thumbnail video_filters video_tags %}

{% block page_content %}
{% if MAINTENANCE_MODE %}
Expand Down
3 changes: 1 addition & 2 deletions pod/podfile/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Esup-Pod podfile URL Configuration."""

from django.urls import path
from django.urls import re_path
from django.urls import path, re_path

from .views import home, get_folder_files, get_file
from .views import editfolder, deletefolder
Expand Down
2 changes: 1 addition & 1 deletion pod/progressive_web_app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
DEFAULT_ICON = static("img/icon_x1024.png")


def notify_user(user, title, message, url=None, icon=None):
def notify_user(user, title, message, url=None, icon=None) -> None:
"""Fill the payload to send a webpush notification to users devices."""
payload = {
"head": title,
Expand Down
4 changes: 2 additions & 2 deletions pod/recorder/studio_urls_digest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.urls import path
from django.urls import re_path
"""Esup-Pod Studio Recorder urls digest."""
from django.urls import path, re_path

from pod.recorder.views import (
digest_admin_ng_series,
Expand Down
2 changes: 2 additions & 0 deletions pod/video/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Esup-Pod vido context processor."""

from django.conf import settings as django_settings

from pod.video.models import Type
Expand Down
1 change: 0 additions & 1 deletion pod/video/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,6 @@ class Video(models.Model):
"Separate tags with spaces, "
"enclose the tags consist of several words in quotation marks."
),
null=True,
blank=True,
verbose_name=_("Tags"),
)
Expand Down
4 changes: 1 addition & 3 deletions pod/video/templates/videos/card_select.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{% load i18n %}
{% load video_tags %}
{% load video_quiz %}
{% load i18n video_tags video_quiz %}

{% spaceless %}
<div class="card box-shadow pod-card--video video-card">
Expand Down
10 changes: 3 additions & 7 deletions pod/video/templates/videos/video-info.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{% load i18n %}
{% load static %}
{% load thumbnail %}
{% load video_tags %}
{% load playlist_stats %}
{% load favorites_playlist %}
{% load i18n static thumbnail %}
{% load video_tags playlist_stats favorites_playlist %}
{% load speaker_template_tags %}

<div class="video-info_duration-view-share">
Expand Down Expand Up @@ -87,7 +83,7 @@
{% if video.tags %}
<p class="tag-list">{% trans 'Tags:' %}
{% for tag in video.tags.all %}
<a href="{% url 'videos:videos' %}?tag={{ tag }}"
<a href="{% url 'videos:videos' %}?tag={{ tag.slug }}"
{% if request.GET.is_iframe %} target="_blank" {% endif %}
class="btn btn-link btn-sm"
title="{% blocktrans with video_tag=tag %}Show video list having tag “{{ video_tag }}”{% endblocktrans %}" data-bs-toggle="tooltip" data-bs-placement="bottom">
Expand Down
7 changes: 2 additions & 5 deletions pod/video/templates/videos/video.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{% extends 'base.html' %}
{% load i18n %}
{% load static custom_tags %}
{% load thumbnail %}
{% load video_filters %}
{% load video_tags %}
{% load i18n static custom_tags thumbnail %}
{% load video_filters video_tags %}
{% load favorites_playlist %}

{% block opengraph %}
Expand Down
5 changes: 1 addition & 4 deletions pod/video/templates/videos/video_row_select.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{% load i18n %}
{% load favorites_playlist %}
{% load playlist_buttons %}
{% load video_tags %}
{% load i18n favorites_playlist playlist_buttons video_tags %}

{% spaceless %}
{% if playlist %}
Expand Down
6 changes: 3 additions & 3 deletions pod/video/templatetags/video_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_marker_time_for_user(video: Video, user: User):


@register.simple_tag(name="get_percent_marker_for_user")
def get_percent_marker_for_user(video: Video, user: User):
def get_percent_marker_for_user(video: Video, user: User) -> int:
"""Tag to get the percent time of the video viewed by the authenticated user."""
if video.duration and video.duration != 0:
return int((video.get_marker_time_for_user(user) / video.duration) * 100)
Expand All @@ -43,7 +43,7 @@ def get_percent_marker_for_user(video: Video, user: User):


@register.filter(name="file_exists")
def file_exists(filepath):
def file_exists(filepath) -> bool:
return check_file(filepath.path)


Expand All @@ -60,7 +60,7 @@ def file_date_modified(filepath):


@register.simple_tag
def get_app_link(video, app):
def get_app_link(video, app) -> str:
mod = importlib.import_module("pod.%s.models" % app)
if hasattr(mod, capfirst(app)):
video_app = eval(
Expand Down
3 changes: 1 addition & 2 deletions pod/video/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.conf import settings
from django.urls import re_path
from django.urls import include, path
from django.urls import include, path, re_path

from .views import (
video,
Expand Down
4 changes: 2 additions & 2 deletions pod/video/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,7 @@ def get_com_tree(com):
return tree


def can_edit_or_remove_note_or_com(request, nc, action):
def can_edit_or_remove_note_or_com(request, nc, action) -> None:
"""
Check if the current user can apply action to the note or comment nc.
Expand All @@ -1671,7 +1671,7 @@ def can_edit_or_remove_note_or_com(request, nc, action):
raise PermissionDenied


def can_see_note_or_com(request, nc):
def can_see_note_or_com(request, nc) -> None:
"""
Check if the current user can view the note or comment nc.
Expand Down
29 changes: 22 additions & 7 deletions pod/video_search/readme → pod/video_search/Readme.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
Installation of version 6 on debian:
$>https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html
Installation of ICU Analysis
# Installation of ElasticSearch on Debian

https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html

## Installation of ICU Analysis

```sh
$>root@Pod:/usr/share/elasticsearch# bin/elasticsearch-plugin install analysis-icu
Configuration
````

## Configuration

```sh
$>root@Pod:/etc/elasticsearch# vim elasticsearch.yml
- cluster.name: pod-application
- node.name: pod-1
- discovery.zen.ping.unicast.hosts: ["elasticsearch.localhost"]
?? Use Cerebro: https://github.com/lmenezes/cerebro
```

## To create pod index

To create pod index:
```sh
(django_pod) pod@Pod:~/django_projects/podv3$ python manage.py create_pod_index
To delete pod index:
```

## To delete pod index

```sh
$>curl -XDELETE elasticsearch.localhost:9200/pod
```
2 changes: 1 addition & 1 deletion pod/video_search/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ class SearchForm(forms.Form):
widget=widgets.AdminDateWidget(attrs={"type": "date"}),
)

def __init__(self, *args, **kwargs):
def __init__(self, *args, **kwargs) -> None:
super(SearchForm, self).__init__(*args, **kwargs)
self.fields = add_placeholder_and_asterisk(self.fields)
6 changes: 3 additions & 3 deletions pod/video_search/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@receiver(post_save, sender=Video)
def update_video_index(
sender, instance=None, created=False, **kwargs
): # pragma: no cover
) -> None: # pragma: no cover
"""Start index_video as daemon thread."""
if ES_URL is None:
return
Expand All @@ -25,7 +25,7 @@ def update_video_index(
t.start()


def index_video(video): # pragma: no cover
def index_video(video) -> None: # pragma: no cover
"""Add video in ES index."""
if video.is_draft is False and video.encoding_in_progress is False:
index_es(video)
Expand All @@ -36,7 +36,7 @@ def index_video(video): # pragma: no cover
@receiver(pre_delete, sender=Video)
def delete_video_index(
sender, instance=None, created=False, **kwargs
): # pragma: no cover
) -> None: # pragma: no cover
"""Start delete_es as daemon thread."""
if ES_URL is None:
return
Expand Down
Loading

0 comments on commit dfd0662

Please sign in to comment.