-
Notifications
You must be signed in to change notification settings - Fork 709
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade dependencies and test matrix for Python 3.13.
Add new migration for updated le-utils. Add cgi forward port compatibility patch.
- Loading branch information
Showing
8 changed files
with
119 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
kolibri/core/content/migrations/0038_alter_localfile_extension.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Generated by Django 3.2.25 on 2024-10-24 22:56 | ||
from django.db import migrations | ||
from django.db import models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("content", "0037_add_bloompub_preset"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="localfile", | ||
name="extension", | ||
field=models.CharField( | ||
blank=True, | ||
choices=[ | ||
("mp4", "MP4 Video"), | ||
("webm", "WEBM Video"), | ||
("vtt", "VTT Subtitle"), | ||
("mp3", "MP3 Audio"), | ||
("pdf", "PDF Document"), | ||
("jpg", "JPG Image"), | ||
("jpeg", "JPEG Image"), | ||
("png", "PNG Image"), | ||
("gif", "GIF Image"), | ||
("json", "JSON"), | ||
("svg", "SVG Image"), | ||
("perseus", "Perseus Exercise"), | ||
("graphie", "Graphie Exercise"), | ||
("zip", "HTML5 Zip"), | ||
("h5p", "H5P"), | ||
("zim", "ZIM"), | ||
("epub", "ePub Document"), | ||
("bloompub", "Bloom Document"), | ||
("bloomd", "Bloom Document"), | ||
], | ||
max_length=40, | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
""" | ||
A minimal port of the removed cgi module for use in Python 3.13. | ||
Only imports the specific parts of the module that are used by Django. | ||
Informed by the PR that removed its use in Django: | ||
https://github.com/django/django/pull/15679 | ||
""" | ||
|
||
|
||
def _parseparam(s): | ||
while s[:1] == ";": | ||
s = s[1:] | ||
end = s.find(";") | ||
while end > 0 and (s.count('"', 0, end) - s.count('\\"', 0, end)) % 2: | ||
end = s.find(";", end + 1) | ||
if end < 0: | ||
end = len(s) | ||
f = s[:end] | ||
yield f.strip() | ||
s = s[end:] | ||
|
||
|
||
def parse_header(line): | ||
""" | ||
Parse a Content-type like header. | ||
Return the main content-type and a dictionary of options. | ||
""" | ||
parts = _parseparam(";" + line) | ||
key = parts.__next__() | ||
pdict = {} | ||
for p in parts: | ||
i = p.find("=") | ||
if i >= 0: | ||
name = p[:i].strip().lower() | ||
value = p[i + 1 :].strip() | ||
if len(value) >= 2 and value[0] == value[-1] == '"': | ||
value = value[1:-1] | ||
value = value.replace("\\\\", "\\").replace('\\"', '"') | ||
pdict[name] = value | ||
return key, pdict | ||
|
||
|
||
boundary_re = None | ||
|
||
|
||
def valid_boundary(boundary): | ||
# Do this import here to avoid importing dependencies in the env module. | ||
from django.utils.regex_helper import _lazy_re_compile | ||
|
||
global boundary_re | ||
|
||
if boundary_re is None: | ||
boundary_re = _lazy_re_compile(rb"[ -~]{0,200}[!-~]") | ||
return boundary_re.fullmatch(boundary) is not None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters