Skip to content

Commit fd4e68c

Browse files
ronryvprandlapxsitMuaath Alqarnilittlecube8152
authored
Sync/upstream merge 2025 10 31 (#21)
* CWS: Mark ajax request endpoints as @api_login_required (cms-dev#1522) This prevents cases where they would redirect to the login screen unexpectedly. Also improved handling of errors in the submission details popup. * AWS: don't refresh the page when contest phase changes (cms-dev#1510) * make AWS more resilient towards missing ScoreTypes and Languages (cms-dev#1460) * Translated using Weblate (Estonian) Currently translated at 100.0% (311 of 311 strings) Translation: CMS/main Translate-URL: https://hosted.weblate.org/projects/cms/main/et/ * Translated using Weblate (French) Currently translated at 100.0% (311 of 311 strings) Translation: CMS/main Translate-URL: https://hosted.weblate.org/projects/cms/main/fr/ * Translated using Weblate (Arabic) Currently translated at 54.9% (171 of 311 strings) Translation: CMS/main Translate-URL: https://hosted.weblate.org/projects/cms/main/ar/ * Translated using Weblate (Chinese (Traditional Han script)) Currently translated at 67.5% (210 of 311 strings) Translation: CMS/main Translate-URL: https://hosted.weblate.org/projects/cms/main/zh_Hant/ * Translated using Weblate (Italian) Currently translated at 100.0% (311 of 311 strings) Translation: CMS/main Translate-URL: https://hosted.weblate.org/projects/cms/main/it/ * Initialize Hebrew translation * mention weblate more explicitly in README (cms-dev#1531) this was requested by the Weblate support team. * Remove some unused files (cms-dev#1533) We don't use codacy any more (at least it doesn't seem so?) and we use weblate instead of onesky now. * Fix possible timing leak in validate_password (cms-dev#1535) * Make the helper scripts in docker/ a bit more robust When the git repo is in a detached HEAD state, GIT_BRANCH_NAME became "HEAD", which docker does not like as a project name. So I lowercased it and added a cms- in front for good measure. * Make functional test suite not depend on git * Bump gevent from 25.5.1 to 25.8.1 (cms-dev#1538) Bumps [gevent](https://github.com/gevent/gevent) from 25.5.1 to 25.8.1. - [Release notes](https://github.com/gevent/gevent/releases) - [Changelog](https://github.com/gevent/gevent/blob/master/docs/changelog_pre.rst) - [Commits](gevent/gevent@25.5.1...25.8.1) --- updated-dependencies: - dependency-name: gevent dependency-version: 25.8.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix schema_diff_test on new debian (cms-dev#1551) * Bump zope-event from 5.1 to 6.0 (cms-dev#1555) Bumps [zope-event](https://github.com/zopefoundation/zope.event) from 5.1 to 6.0. - [Changelog](https://github.com/zopefoundation/zope.event/blob/master/CHANGES.rst) - [Commits](zopefoundation/zope.event@5.1...6.0) --- updated-dependencies: - dependency-name: zope-event dependency-version: '6.0' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump zope-interface from 7.2 to 8.0 (cms-dev#1554) Bumps [zope-interface](https://github.com/zopefoundation/zope.interface) from 7.2 to 8.0. - [Changelog](https://github.com/zopefoundation/zope.interface/blob/master/CHANGES.rst) - [Commits](zopefoundation/zope.interface@7.2...8.0) --- updated-dependencies: - dependency-name: zope-interface dependency-version: '8.0' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump version to 1.6.dev0 (cms-dev#1532) * Add rws public config and configurable id column * Avoid reading GEN if score parameters are already found in task.yaml * Fixes --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: p. randla <[email protected]> Co-authored-by: Pasit Sangprachathanarak <[email protected]> Co-authored-by: Muaath Alqarni <[email protected]> Co-authored-by: LittleCube <[email protected]> Co-authored-by: William Di Luigi <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Elia Soldati <[email protected]> Co-authored-by: Francesco Vercellesi <[email protected]>
1 parent 82f0ff1 commit fd4e68c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1499
-448
lines changed

.codacy.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ Dockerfile
44
codecov/
55
.dev/
66
.venv/
7+
.git/
8+
.jj/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Homepage: <http://cms-dev.github.io/>
88
[![Get support on Telegram](https://img.shields.io/badge/Questions%3F-Join%20the%20Telegram%20group!-%2326A5E4?style=flat&logo=telegram)](https://t.me/contestms)
99
[![Translation status](https://hosted.weblate.org/widget/cms/svg-badge.svg)](https://hosted.weblate.org/engage/cms/)
1010

11-
[🌍 Help translate CMS in your language!](https://hosted.weblate.org/engage/cms/)
11+
[🌍 Help translate CMS in your language using Weblate!](https://hosted.weblate.org/engage/cms/)
1212

1313
Introduction
1414
------------

cms/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
]
4747

4848

49-
__version__ = "1.5.1"
49+
__version__ = "1.6.dev0"
5050

5151

5252
# Instantiate or import these objects.

cms/db/contest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ def phase(self, timestamp: datetime) -> int:
306306
307307
timestamp: the time we are iterested in.
308308
"""
309+
# NOTE: this logic is duplicated in aws_utils.js.
309310
if timestamp < self.start:
310311
return -1
311312
if timestamp <= self.stop:

cms/grading/languagemanager.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,20 @@
1818

1919
"""Provide utilities to work with programming language classes."""
2020

21+
import logging
2122
from cms import plugin_list
2223
from cms.grading.language import Language
2324

24-
2525
__all__ = [
2626
"LANGUAGES",
2727
"HEADER_EXTS", "SOURCE_EXTS", "OBJECT_EXTS",
2828
"get_language", "filename_to_language"
2929
]
3030

3131

32+
logger = logging.getLogger(__name__)
33+
34+
3235
LANGUAGES: list[Language] = list()
3336
_BY_NAME: dict[str, Language] = dict()
3437
HEADER_EXTS: set[str] = set()
@@ -50,6 +53,25 @@ def get_language(name: str) -> Language:
5053
return _BY_NAME[name]
5154

5255

56+
def safe_get_lang_filename(lang: str | None, filename: str) -> str:
57+
"""Get the filename of a file in a specific programming language,
58+
avoiding errors if the language isn't recognized.
59+
60+
lang: name of the programming language
61+
filename: filename template (containing .%l)
62+
return: filename with the template replaced.
63+
"""
64+
if lang is None:
65+
return filename
66+
try:
67+
language = get_language(lang)
68+
source_ext = language.source_extension
69+
except KeyError:
70+
logger.warning(f"Found invalid language {lang}!")
71+
source_ext = ".invalid_language"
72+
return filename.replace(".%l", source_ext)
73+
74+
5375
def filename_to_language(filename: str, available_languages: list[Language] | None=None) -> Language | None:
5476
"""Return one of the languages inferred from the given filename.
5577

cms/locale/ar/LC_MESSAGES/cms.po

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
21
msgid ""
32
msgstr ""
4-
"Project-Id-Version: VERSION\n"
3+
"Project-Id-Version: VERSION\n"
54
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
65
"POT-Creation-Date: 2025-08-16 14:52+0300\n"
7-
"PO-Revision-Date: 2025-08-16 12:04+0000\n"
8-
"Last-Translator: Pasit Sangprachathanarak <[email protected]>\n"
9-
"Language: ar\n"
6+
"PO-Revision-Date: 2025-08-20 09:02+0000\n"
7+
"Last-Translator: Muaath Alqarni <[email protected]>\n"
108
"Language-Team: Arabic <https://hosted.weblate.org/projects/cms/main/ar/>\n"
11-
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
9+
"Language: ar\n"
1210
"MIME-Version: 1.0\n"
1311
"Content-Type: text/plain; charset=utf-8\n"
1412
"Content-Transfer-Encoding: 8bit\n"
13+
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
14+
"X-Generator: Weblate 5.13\n"
1515
"Generated-By: Babel 2.12.1\n"
1616

1717
msgid "N/A"
@@ -42,7 +42,7 @@ msgid "Memory used"
4242
msgstr "الذاكرة المستعملة"
4343

4444
msgid "Score details temporarily unavailable."
45-
msgstr ""
45+
msgstr "تفاصيل الدرجة غير متوفرة مؤقتًا."
4646

4747
#, python-format
4848
msgid "Subtask %(index)s"
@@ -52,24 +52,23 @@ msgid "Compilation succeeded"
5252
msgstr "نجح التحويل"
5353

5454
msgid "Your submission successfully compiled to an executable."
55-
msgstr ""
55+
msgstr "تسليمك حوِّل بنجاح إلى برنامج."
5656

5757
msgid "Compilation failed"
5858
msgstr "فشل التحويل"
5959

60-
#, fuzzy
6160
msgid "Your submission did not compile correctly."
62-
msgstr "تسليمك استغرق من وقت المعالج أكثر من الحد"
61+
msgstr "تسليمك لم يحول بشكل صحيح."
6362

6463
msgid "Compilation timed out"
6564
msgstr "التحويل تجاوز حد الوقت"
6665

6766
msgid "Your submission exceeded the time limit while compiling. This might be caused by an excessive use of C++ templates, for example."
68-
msgstr ""
67+
msgstr "استغرق تسليمك أكثر من حد الوقت للتحويل. قد يكون بسبب C++ templates على سبيل المثال."
6968

70-
#, fuzzy, python-format
69+
#, python-format
7170
msgid "Compilation killed with signal %s (could be triggered by violating memory limits)"
72-
msgstr "أوقف التنفيذ (قد يكون بسبب الوصول لذاكرة غير مصرح بها)"
71+
msgstr "أوقفت عملية التحويل بإشارة %s (قد يكون بسبب الوصول لذاكرة غير مصرح بها)"
7372

7473
msgid "Your submission was killed with the specified signal. Among other things, this might be caused by exceeding the memory limit for the compilation, and in turn by an excessive use of C++ templates, for example."
7574
msgstr ""
@@ -78,7 +77,7 @@ msgid "Output is correct"
7877
msgstr "المخرجات صحيحة"
7978

8079
msgid "Your submission ran and gave the correct answer"
81-
msgstr ""
80+
msgstr "شغّل تسليمك وأعطى إجابة صحيحة"
8281

8382
msgid "Output is partially correct"
8483
msgstr "المخرجات صحيحة جزئيًا"
@@ -1106,4 +1105,3 @@ msgstr ""
11061105

11071106
#~ msgid "Standard Template Library"
11081107
#~ msgstr "المكتبة الأساسية"
1109-

cms/locale/et/LC_MESSAGES/cms.po

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ msgstr ""
33
"Project-Id-Version: VERSION\n"
44
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
55
"POT-Creation-Date: 2025-08-16 14:52+0300\n"
6-
"PO-Revision-Date: 2025-08-16 15:53+0000\n"
6+
"PO-Revision-Date: 2025-08-17 17:02+0000\n"
77
"Last-Translator: \"p. randla\" <[email protected]>\n"
88
"Language-Team: Estonian <https://hosted.weblate.org/projects/cms/main/et/>\n"
99
"Language: et\n"
@@ -414,7 +414,7 @@ msgid "Subject"
414414
msgstr "Teema"
415415

416416
msgid "Text"
417-
msgstr "Tekst"
417+
msgstr "Sisu"
418418

419419
msgid "Ask question"
420420
msgstr "Esita küsimus"
@@ -550,7 +550,7 @@ msgid "An error occured while the server was handling your request."
550550
msgstr "Päringu töötlemise käigus esines viga."
551551

552552
msgid "Note that attempts to tamper with Contest Management System (such as probing the server with customized URLs) may be considered cheating and may lead to disqualification."
553-
msgstr "Pange tähele, et Contest Management System'i ebaotstarbeline kasutus (nagu näiteks moonutatud URL-ide katsetamine) võib olla interpreteeritud kui sohitegemise katse, ning kaasa tuua diskvalifikatsiooni."
553+
msgstr "Pange tähele, et Contest Management System'i ebasihipärast kasutamist (näiteks moonutatud URL-ide katsetamine) võidakse tõlgendada sohitegemise katsena, mis võib põhjustada diskvalifitseerimise."
554554

555555
msgid "If you encountered this error during normal usage, please notify the contest administrators."
556556
msgstr "Kui te avastasite selle vea normaalse kasutuse käigus, palun teavitage võistluse administraatoreid."
@@ -691,7 +691,7 @@ msgid "Start!"
691691
msgstr "Alusta!"
692692

693693
msgid "Task overview"
694-
msgstr "Ülesande info"
694+
msgstr "Ülesannete ülevaade"
695695

696696
msgid "Task"
697697
msgstr "Ülesanne"

cms/locale/fr/LC_MESSAGES/cms.po

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
21
msgid ""
32
msgstr ""
4-
"Project-Id-Version: VERSION\n"
3+
"Project-Id-Version: VERSION\n"
54
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
65
"POT-Creation-Date: 2025-08-16 14:52+0300\n"
7-
"PO-Revision-Date: 2025-06-06 09:35+0000\n"
8-
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
9-
"Language: fr_FR\n"
10-
"Language-Team: fr_FR TEAM <EMAIL@ADDRESS>\n"
11-
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
6+
"PO-Revision-Date: 2025-08-17 17:02+0000\n"
7+
"Last-Translator: Pasit Sangprachathanarak <[email protected]>\n"
8+
"Language-Team: French <https://hosted.weblate.org/projects/cms/main/fr/>\n"
9+
"Language: fr\n"
1210
"MIME-Version: 1.0\n"
1311
"Content-Type: text/plain; charset=utf-8\n"
1412
"Content-Transfer-Encoding: 8bit\n"
13+
"Plural-Forms: nplurals=2; plural=n > 1;\n"
14+
"X-Generator: Weblate 5.13\n"
1515
"Generated-By: Babel 2.12.1\n"
1616

1717
msgid "N/A"
@@ -77,7 +77,7 @@ msgid "Output is correct"
7777
msgstr "Sortie correcte"
7878

7979
msgid "Your submission ran and gave the correct answer"
80-
msgstr "Votre soumission a été exécutée et a donné la réponse correcte."
80+
msgstr "Votre soumission a été exécutée et a donné la réponse correcte"
8181

8282
msgid "Output is partially correct"
8383
msgstr "La sortie est partiellement correcte"
@@ -89,7 +89,7 @@ msgid "Output isn't correct"
8989
msgstr "Sortie incorrecte"
9090

9191
msgid "Your submission ran, but gave the wrong answer"
92-
msgstr "Votre soumission a été exécutée mais donne une réponse incorrecte."
92+
msgstr "Votre soumission a été exécutée mais donne une réponse incorrecte"
9393

9494
#, python-format
9595
msgid "Evaluation didn't produce file %s"
@@ -102,31 +102,28 @@ msgid "Execution timed out"
102102
msgstr "Durée maximale d'exécution dépassée"
103103

104104
msgid "Your submission used too much CPU time."
105-
msgstr "Votre soumission a utilisé trop de temps CPU (processeur)"
105+
msgstr "Votre soumission a utilisé trop de temps CPU (processeur)."
106106

107107
msgid "Execution timed out (wall clock limit exceeded)"
108108
msgstr "Temps d'exécution dépassé (durée maximale dépassée)"
109109

110110
msgid "Your submission used too much total time. This might be triggered by undefined code, or buffer overflow, for example. Note that in this case the CPU time visible in the submission details might be much smaller than the time limit."
111111
msgstr "Votre soumission a pris trop de temps. Cela peut être causé, par exemple, par un code indéfini ou une écriture hors mémoire allouée. Notez que dans ce cas, le temps CPU (processeur) visible dans les détails de la soumission peut être bien plus petit que la limite de temps."
112112

113-
#, fuzzy
114113
msgid "Memory limit exceeded"
115-
msgstr "Limite de mémoire"
114+
msgstr "Limite de mémoire dépassée"
116115

117-
#, fuzzy
118116
msgid "Your submission used too much memory."
119-
msgstr "Votre soumission a utilisé trop de temps CPU (processeur)"
117+
msgstr "Votre soumission a utilisé trop de mémoire."
120118

121-
#, fuzzy
122119
msgid "Execution killed by signal"
123-
msgstr "Durée maximale d'exécution dépassée"
120+
msgstr "Exécution interrompue par un signal"
124121

125122
msgid "The evaluation was killed by a signal."
126-
msgstr ""
123+
msgstr "L'évaluation a été tuée par un signal."
127124

128125
msgid "Execution failed because the return code was nonzero"
129-
msgstr "Exécution échouée: code de retour différent de zéro"
126+
msgstr "Exécution échouée : code de retour différent de zéro"
130127

131128
msgid "Your submission failed because it exited with a return code different from 0."
132129
msgstr "Votre soumission a échouée car elle a terminé avec un code de retour différent de 0."
@@ -349,7 +346,7 @@ msgstr "Chaque fichier source ne peut pas faire plus de %d octets."
349346

350347
#, python-format
351348
msgid "The submission should contain at most %d files."
352-
msgstr ""
349+
msgstr "La soumission doit contenir au maximum %d fichiers."
353350

354351
msgid "Invalid archive format!"
355352
msgstr "Format d'archive invalide !"
@@ -443,7 +440,7 @@ msgid "Logged in as <strong>%(first_name)s %(last_name)s</strong> <em>(%(usernam
443440
msgstr "Connecté en tant que <strong>%(first_name)s %(last_name)s</strong> <em>(%(username)s)</em>"
444441

445442
msgid "Failed to log in."
446-
msgstr "Connexion impossible"
443+
msgstr "Échec de la connexion."
447444

448445
msgid "Welcome"
449446
msgstr "Bienvenue"
@@ -658,7 +655,7 @@ msgstr "Vous pouvez soumettre au maximum %(submissions)s solutions durant ce con
658655

659656
#, python-format
660657
msgid "You can submit at most %(user_tests)s user tests during this contest."
661-
msgstr "Vous pouvez soumettre au maximum %(user_tests)s tests utilisateurs durant ce concours "
658+
msgstr "Vous pouvez soumettre au maximum %(user_tests)s tests utilisateurs durant ce concours."
662659

663660
#, python-format
664661
msgid "Every user is allowed to compete (i.e. submit solutions) for a uninterrupted time frame of %(per_user_time)s."
@@ -668,7 +665,7 @@ msgid "As soon as the contest starts you can choose to start your time frame."
668665
msgstr "Dès que le concours a débuté, vous pouvez choisir la fourchette de temps pendant laquelle vous participez."
669666

670667
msgid "Once you start, you can submit solutions until the end of the time frame or until the end of the contest, whatever comes first."
671-
msgstr "Lorsque vous avez commencé, vous pouvez soumettre jusqu'à ce que votre fourchette de participation soit terminée ou que le concours se termine (selon le premier ayant lieu)"
668+
msgstr "Lorsque vous avez commencé, vous pouvez soumettre jusqu'à ce que votre fourchette de participation soit terminée ou que le concours se termine (selon le premier ayant lieu)."
672669

673670
msgid "By clicking on the button below you can start your time frame."
674671
msgstr "En cliquant sur le bouton ci-dessous, vous commencerez votre fourchette de participation."
@@ -1027,7 +1024,7 @@ msgid "Invalid file"
10271024
msgstr "Fichier invalide"
10281025

10291026
msgid "Print job has too many pages"
1030-
msgstr "Le document à imprimer est trop long."
1027+
msgstr "Le document à imprimer est trop long"
10311028

10321029
msgid "Sent to printer"
10331030
msgstr "Envoyer à l'imprimante"
@@ -1040,4 +1037,3 @@ msgstr "Envoyer à l'imprimante"
10401037

10411038
#~ msgid "Standard Template Library"
10421039
#~ msgstr "Librairie Standard C++ (STL)"
1043-

0 commit comments

Comments
 (0)