From ac98ffe7cb268db4aa16040298e8512270db2545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jirka=20Sch=C3=A4fer?= Date: Fri, 15 Jul 2022 10:06:38 +0200 Subject: [PATCH 01/19] deepl: allow source lang auto detection --- rosetta/templates/rosetta/js/rosetta.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rosetta/templates/rosetta/js/rosetta.js b/rosetta/templates/rosetta/js/rosetta.js index 8e65f78..3532b42 100644 --- a/rosetta/templates/rosetta/js/rosetta.js +++ b/rosetta/templates/rosetta/js/rosetta.js @@ -33,7 +33,7 @@ $(document).ready(function() { headers: { "Content-Type": "application/x-www-form-urlencoded" }, - body: `auth_key=${authKey}&text=${orig}&source_lang=${sourceLang}&target_lang=${destLangRoot}` + body: `auth_key=${authKey}&text=${orig}&target_lang=${destLangRoot}` }).then(response => { if(response.ok) { return response.json(); From 6b19cdfd18e8622ed9d874f028aa04b08edf7271 Mon Sep 17 00:00:00 2001 From: Marco Bonetti Date: Tue, 17 Jan 2023 15:55:02 +0100 Subject: [PATCH 02/19] Test against Django 4.2a --- CHANGES | 1 + tox.ini | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index ba8e238..9e2a8ce 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ Version 0.9.9 (unreleased) * Limit supported versions to Django 3.2 and later, using Python 3.8, 3.9 and 3.10 * Proxy Deepl translations suggestions through the back-end to avoid CORS issues. (#271 thanks @rafaelromon, @biermeester and @matthiask) * Format code with pre-commit +* Test against Django 4.2a Version 0.9.8 diff --git a/tox.ini b/tox.ini index 8bacb0d..6bdf633 100644 --- a/tox.ini +++ b/tox.ini @@ -1,16 +1,16 @@ [tox] envlist = flake8, - py{38,39,310}-django{32,40,41}, + py{38,39,310}-django{32,40,41,42}, gettext, docs [gh-actions] python = - 3.10: py310-django32, py310-django40, py310-django41 - 3.9: py39-django32, py39-django40, py39-django41 - 3.8: py38-django32, py38-django40, py38-django41 + 3.10: py310-django32, py310-django40, py310-django41, py310-django42 + 3.9: py39-django32, py39-django40, py39-django41, py39-django42 + 3.8: py38-django32, py38-django40, py38-django41, py38-django42 skipsdist = True @@ -30,6 +30,7 @@ deps = django32: Django>=3.2,<=3.2.99 django40: Django>=4.0,<4.1 django41: Django>=4.1a,<4.2 + django42: Django>=4.2a,<4.3 pymemcache requests From 51dc6bf02e079adea063e2309a0bcbe2017c1795 Mon Sep 17 00:00:00 2001 From: Jirka Schaefer Date: Wed, 29 Mar 2023 22:46:26 +0200 Subject: [PATCH 03/19] allow language variant with @ in url --- rosetta/urls.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rosetta/urls.py b/rosetta/urls.py index 2843a42..6c53856 100644 --- a/rosetta/urls.py +++ b/rosetta/urls.py @@ -27,12 +27,12 @@ urlpatterns = [ name="rosetta-file-list", ), re_path( - r"^files/(?P[\w-]+)/(?P[\w\-_\.]+)/(?P\d+)/$", + r"^files/(?P[\w-]+)/(?P[\w\-_\.@]+)/(?P\d+)/$", views.TranslationFormView.as_view(), name="rosetta-form", ), re_path( - r"^files/(?P[\w-]+)/(?P[\w\-_\.]+)/(?P\d+)/download/$", + r"^files/(?P[\w-]+)/(?P[\w\-_\.@]+)/(?P\d+)/download/$", views.TranslationFileDownload.as_view(), name="rosetta-download-file", ), From 013fbbbb8d40c8fb1d39abf79219c31c2b1ee20c Mon Sep 17 00:00:00 2001 From: Jirka Schaefer Date: Wed, 29 Mar 2023 22:51:51 +0200 Subject: [PATCH 04/19] make file system case sensitive a setting to allow docker/mac inconsistency override --- rosetta/poutil.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/rosetta/poutil.py b/rosetta/poutil.py index da9d28b..5ff8b9b 100644 --- a/rosetta/poutil.py +++ b/rosetta/poutil.py @@ -1,5 +1,4 @@ import os -import tempfile from datetime import datetime import django @@ -71,11 +70,9 @@ def find_pos(lang, project_apps=True, django_apps=False, third_party_apps=False) ) ) - case_sensitive_file_system = True - tmphandle, tmppath = tempfile.mkstemp() - if os.path.exists(tmppath.upper()): - # Case insensitive file system. - case_sensitive_file_system = False + case_sensitive_file_system = getattr( + settings, "ROSETTA_CASE_SENSITIVE_FILESYSTEM", False + ) # django/locale if django_apps: From f9fb95a158cf20106fc6acffc84f72bdf4f2a10f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jirka=20Sch=C3=A4fer?= Date: Thu, 30 Mar 2023 09:34:45 +0200 Subject: [PATCH 05/19] Update CHANGES --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 9e2a8ce..f2bdc0c 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,7 @@ Version 0.9.9 (unreleased) * Proxy Deepl translations suggestions through the back-end to avoid CORS issues. (#271 thanks @rafaelromon, @biermeester and @matthiask) * Format code with pre-commit * Test against Django 4.2a +* replace case sensitivity check with setting Version 0.9.8 From b70d283ee8c4ed5b7e9762cf1c9845d2af3d2141 Mon Sep 17 00:00:00 2001 From: Jirka Schaefer Date: Fri, 31 Mar 2023 14:53:36 +0200 Subject: [PATCH 06/19] allow setting to override case sensitive detection --- docs/settings.rst | 1 + rosetta/poutil.py | 12 ++++++++++- rosetta/tests/tests.py | 45 +++++++++++++++++++++++++++++++----------- 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 55d5d08..a26780d 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -27,6 +27,7 @@ Rosetta can be configured via the following parameters, to be defined in your pr * ``ROSETTA_LOGIN_URL``: Use this if you want to override the login URL for rosetta. Defaults to ``settings.LOGIN_URL``. * ``ROSETTA_LANGUAGES``: List of languages that Rosetta will offer to translate. This is useful when you wish to translate a language that is not yet defined in ``settings.LANGUAGES``. Defaults to ``settings.LANGUAGES``. * ``ROSETTA_SHOW_OCCURRENCES``: Determines whether occurrences (where the original text appears) should be shown next to the translations for context. Defaults to ``True``. +* ``ROSETTA_CASE_SENSITIVE_FILESYSTEM``: Overrides auto-detection of case sensitive OS. Defaults to ``None`` which enables auto-detection. Useful when running case sensitive OS (e.g. Ubuntu) in docker on case insensitive OS (e.g. MacOS). diff --git a/rosetta/poutil.py b/rosetta/poutil.py index 5ff8b9b..011e4b7 100644 --- a/rosetta/poutil.py +++ b/rosetta/poutil.py @@ -1,4 +1,5 @@ import os +import tempfile from datetime import datetime import django @@ -70,10 +71,19 @@ def find_pos(lang, project_apps=True, django_apps=False, third_party_apps=False) ) ) + # is OS case sensitive? settings preferred over auto detection case_sensitive_file_system = getattr( - settings, "ROSETTA_CASE_SENSITIVE_FILESYSTEM", False + settings, "ROSETTA_CASE_SENSITIVE_FILESYSTEM", None ) + # in case of no settings, attempt auto detection + if case_sensitive_file_system is None: + case_sensitive_file_system = True + tmphandle, tmppath = tempfile.mkstemp() + if os.path.exists(tmppath.upper()): + # Case insensitive file system. + case_sensitive_file_system = False + # django/locale if django_apps: django_paths = cache.get("rosetta_django_paths") diff --git a/rosetta/tests/tests.py b/rosetta/tests/tests.py index 9015ad1..f1d43aa 100644 --- a/rosetta/tests/tests.py +++ b/rosetta/tests/tests.py @@ -2,10 +2,9 @@ import filecmp import hashlib import os import shutil +from unittest import mock from urllib.parse import urlencode -import vcr - from django import VERSION from django.conf import settings from django.core.exceptions import ImproperlyConfigured @@ -16,7 +15,9 @@ from django.test.client import Client from django.urls import resolve, reverse from django.utils.encoding import force_bytes +import vcr from rosetta import views +from rosetta.poutil import find_pos from rosetta.signals import entry_changed, post_save from rosetta.storage import get_storage @@ -382,14 +383,16 @@ class RosettaTestCase(TestCase): # Post a translation, it should have properly wrapped lines data = { - "m_bb9d8fe6159187b9ea494c1b313d23d4": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean " - "commodo ligula eget dolor. Aenean massa. Cum sociis natoque " - "penatibus et magnis dis parturient montes, nascetur ridiculus " - "mus. Donec quam felis, ultricies nec, pellentesque eu, pretium " - "quis, sem. Nulla consequat massa quis enim. Donec pede justo, " - "fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, " - "rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum " - "felis eu pede mollis pretium." + "m_bb9d8fe6159187b9ea494c1b313d23d4": ( + "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean " + "commodo ligula eget dolor. Aenean massa. Cum sociis natoque " + "penatibus et magnis dis parturient montes, nascetur ridiculus " + "mus. Donec quam felis, ultricies nec, pellentesque eu, pretium " + "quis, sem. Nulla consequat massa quis enim. Donec pede justo, " + "fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, " + "rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum " + "felis eu pede mollis pretium." + ) } r = self.client.post(self.xx_form_url, data) with open(self.dest_file, "r") as po_file: @@ -762,8 +765,9 @@ class RosettaTestCase(TestCase): msg_hashes = message_hashes() data = {msg_hashes["String 1"]: "Translation 1"} self.client.post(self.xx_form_url, data) - po_file_hash_before, mo_file_hash_before = file_hash(po_file), file_hash( - mo_file + po_file_hash_before, mo_file_hash_before = ( + file_hash(po_file), + file_hash(mo_file), ) # Make a change to the translations @@ -1053,6 +1057,23 @@ class RosettaTestCase(TestCase): resp = self.client.get(reverse("admin:index")) self.assertNotContains(resp, "rosetta-content-main") + @mock.patch("rosetta.poutil.os.path.exists") + def test_273_override_case_sensitivity(self, path_mock): + path_mock.exists.return_value = False + # no setting + find_pos("en") + path_mock.assert_called_with(mock.ANY) + + path_mock.reset_mock() + with override_settings(ROSETTA_CASE_SENSITIVE_FILESYSTEM=False): + find_pos("en") + path_mock.isfile.assert_not_called() + + path_mock.reset_mock() + with override_settings(ROSETTA_CASE_SENSITIVE_FILESYSTEM=True): + find_pos("en") + path_mock.isfile.assert_not_called() + # Stubbed access control function def no_access(user): From f511555ade1bf47cec4c5774fa70d59f5dddd847 Mon Sep 17 00:00:00 2001 From: stephanema1 <131151746+stephanema1@users.noreply.github.com> Date: Tue, 18 Apr 2023 11:40:29 +0200 Subject: [PATCH 07/19] Use actual jquery.js from local django instance instead of trying to use a jquery from the internet --- rosetta/templates/rosetta/base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rosetta/templates/rosetta/base.html b/rosetta/templates/rosetta/base.html index 48611dd..ad9cdfe 100644 --- a/rosetta/templates/rosetta/base.html +++ b/rosetta/templates/rosetta/base.html @@ -11,7 +11,7 @@ {% include 'rosetta/css/rosetta.css' %} {% block extra_styles %}{% endblock %} - + From 44ad012fd98e08003d322f8913f1117e33a3119c Mon Sep 17 00:00:00 2001 From: Marco Bonetti Date: Tue, 18 Apr 2023 15:06:47 +0200 Subject: [PATCH 08/19] Fixes variable detection --- rosetta/templates/rosetta/js/rosetta.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rosetta/templates/rosetta/js/rosetta.js b/rosetta/templates/rosetta/js/rosetta.js index b2f560f..a3e4ab2 100644 --- a/rosetta/templates/rosetta/js/rosetta.js +++ b/rosetta/templates/rosetta/js/rosetta.js @@ -93,7 +93,7 @@ $(document).ready(function() { if($(this).val()) { $('.alert', $(this).parents('tr')).remove(); var RX = /%(?:\([^\s\)]*\))?[sdf]|\{[\w\d_]+?\}/g, - origs=$(this).parents('tr').find('.original>.message').html().match(RX), + origs=$(this).parents('tr').find('.original span').html().match(RX), trads=$(this).val().match(RX), error = $('Unmatched variables'); From 45f184b7e8901a0ab1bf2352672859fa588bc06b Mon Sep 17 00:00:00 2001 From: Marco Bonetti Date: Tue, 18 Apr 2023 15:08:15 +0200 Subject: [PATCH 09/19] update changelog --- CHANGES | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 9e2a8ce..7536f9e 100644 --- a/CHANGES +++ b/CHANGES @@ -3,9 +3,10 @@ Version History Version 0.9.9 (unreleased) -------------------------- +* Use packaged jQuery instead of the CDN version. (#274, thanks @stephanema1) * Test test_47_azure_ajax_translation: avoid DNS lookup for better isolation. Should fix #233 * Adds Chinese (Simplified) translation. (#266 thanks @chenluyong) -* Test against Django 4.1a +* Test against Django 4.2 * Limit supported versions to Django 3.2 and later, using Python 3.8, 3.9 and 3.10 * Proxy Deepl translations suggestions through the back-end to avoid CORS issues. (#271 thanks @rafaelromon, @biermeester and @matthiask) * Format code with pre-commit From 48e14952053412d8dfba5c5020cc574a3b31c500 Mon Sep 17 00:00:00 2001 From: Marco Bonetti Date: Tue, 18 Apr 2023 15:22:35 +0200 Subject: [PATCH 10/19] update changelog --- CHANGES | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index ca7956d..fb6119c 100644 --- a/CHANGES +++ b/CHANGES @@ -6,12 +6,11 @@ Version 0.9.9 (unreleased) * Use packaged jQuery instead of the CDN version. (#274, thanks @stephanema1) * Test test_47_azure_ajax_translation: avoid DNS lookup for better isolation. Should fix #233 * Adds Chinese (Simplified) translation. (#266 thanks @chenluyong) -* Test against Django 4.2 +* Test against Django 4.1 and 4.2 * Limit supported versions to Django 3.2 and later, using Python 3.8, 3.9 and 3.10 * Proxy Deepl translations suggestions through the back-end to avoid CORS issues. (#271 thanks @rafaelromon, @biermeester and @matthiask) * Format code with pre-commit -* Test against Django 4.2a -* replace case sensitivity check with setting +* Replace case sensitivity check with setting (#273 thanks @patroqueeet) Version 0.9.8 From d99ee0dfffec8710c3fa4d977afbb606adc713ed Mon Sep 17 00:00:00 2001 From: Marco Bonetti Date: Tue, 18 Apr 2023 15:36:45 +0200 Subject: [PATCH 11/19] release 0.9.9 --- CHANGES | 4 ++-- docs/conf.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index fb6119c..02822e8 100644 --- a/CHANGES +++ b/CHANGES @@ -1,8 +1,8 @@ Version History =============== -Version 0.9.9 (unreleased) --------------------------- +Version 0.9.9 +------------- * Use packaged jQuery instead of the CDN version. (#274, thanks @stephanema1) * Test test_47_azure_ajax_translation: avoid DNS lookup for better isolation. Should fix #233 * Adds Chinese (Simplified) translation. (#266 thanks @chenluyong) diff --git a/docs/conf.py b/docs/conf.py index b042e1e..e21eca1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -60,7 +60,7 @@ master_doc = "index" # General information about the project. project = "Django Rosetta" -copyright = "2008 – 2021 Marco Bonetti and contributors" +copyright = "2008 – 2023 Marco Bonetti and contributors" author = "Marco Bonetti" From 8452ff66afd1a676e3506c54ebc87985276e6632 Mon Sep 17 00:00:00 2001 From: Matteo Gamboz Date: Fri, 28 Apr 2023 08:47:55 +0200 Subject: [PATCH 12/19] Correct link to polib library The current link to polib https://bitbucket.org/izi/polib seems dead --- docs/usage.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage.rst b/docs/usage.rst index 5d6068e..518d289 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -38,4 +38,4 @@ By default Rosetta hides its own catalog files in the file selection interface ( Acknowledgments *************** -* Rosetta uses the excellent `polib `_ library to parse and handle gettext files. +* Rosetta uses the excellent `polib `_ library to parse and handle gettext files. From 82b549b64659f0a47bb297c55f6fdde3be9bf95f Mon Sep 17 00:00:00 2001 From: Marco Bonetti Date: Fri, 28 Apr 2023 09:07:54 +0200 Subject: [PATCH 13/19] Update changelog, version bump --- CHANGES | 6 ++++++ rosetta/__init__.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 02822e8..89bc85a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,12 @@ Version History =============== +Version 0.9.10 (unreleased) +--------------------------- +* Fix link to polib. (#277, thanks @gamboz) + + + Version 0.9.9 ------------- * Use packaged jQuery instead of the CDN version. (#274, thanks @stephanema1) diff --git a/rosetta/__init__.py b/rosetta/__init__.py index ff477d9..6c5b9d3 100644 --- a/rosetta/__init__.py +++ b/rosetta/__init__.py @@ -6,7 +6,7 @@ try: except ImportError: pass -VERSION = (0, 9, 9) +VERSION = (0, 9, 10) def get_version(limit=3): From d36b89749f0a3512b2560323dc609c471286c8f9 Mon Sep 17 00:00:00 2001 From: Marco Bonetti Date: Thu, 11 May 2023 13:03:18 +0200 Subject: [PATCH 14/19] Deepl: use the PRO API endpoint when using a PRO API key. Fixes #278 --- CHANGES | 2 +- rosetta/translate_utils.py | 7 ++++++- .../vcr_cassettes/test_47_2_deeps_ajax_translation.yaml | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 89bc85a..fdd8272 100644 --- a/CHANGES +++ b/CHANGES @@ -4,7 +4,7 @@ Version History Version 0.9.10 (unreleased) --------------------------- * Fix link to polib. (#277, thanks @gamboz) - +* Deepl: use the PRO API endpoint when using a PRO API key. (#278, thanks @nullcode) Version 0.9.9 diff --git a/rosetta/translate_utils.py b/rosetta/translate_utils.py index 28032c0..b4f2b52 100644 --- a/rosetta/translate_utils.py +++ b/rosetta/translate_utils.py @@ -48,8 +48,13 @@ def translate(text, from_language, to_language): def translate_by_deepl(text, to_language, auth_key): + if auth_key.lower().endswith(":fx"): + endpoint = "https://api-free.deepl.com" + else: + endpoint = "https://api.deepl.com" + r = requests.post( - "https://api-free.deepl.com/v2/translate", + f"{endpoint}/v2/translate", headers={"Authorization": f"DeepL-Auth-Key {auth_key}"}, data={ "target_lang": to_language.upper(), diff --git a/testproject/fixtures/vcr_cassettes/test_47_2_deeps_ajax_translation.yaml b/testproject/fixtures/vcr_cassettes/test_47_2_deeps_ajax_translation.yaml index c633f57..bab63a5 100644 --- a/testproject/fixtures/vcr_cassettes/test_47_2_deeps_ajax_translation.yaml +++ b/testproject/fixtures/vcr_cassettes/test_47_2_deeps_ajax_translation.yaml @@ -17,7 +17,7 @@ interactions: User-Agent: - python-requests/2.26.0 method: POST - uri: https://api-free.deepl.com/v2/translate + uri: https://api.deepl.com/v2/translate response: body: {string: '{"translations": [{"detected_source_language": "EN", "text": "Salut tout le monde"}]}'} headers: From caad6f9e35b5abaab6e2ad23c6466f7027c11a53 Mon Sep 17 00:00:00 2001 From: Marco Bonetti Date: Mon, 4 Dec 2023 16:48:07 +0100 Subject: [PATCH 15/19] preparing v0.10.0 --- .github/workflows/test.yml | 2 +- CHANGES | 5 +++-- docs/conf.py | 2 +- pyproject.toml | 2 +- rosetta/__init__.py | 10 +--------- rosetta/tests/tests.py | 3 ++- setup.py | 13 +++++-------- testproject/settings.py | 31 +++++++++---------------------- tox.ini | 14 +++++++------- 9 files changed, 30 insertions(+), 52 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8239350..94d03fe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: [3.8, 3.9, "3.10"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v1 diff --git a/CHANGES b/CHANGES index fdd8272..0b561af 100644 --- a/CHANGES +++ b/CHANGES @@ -1,10 +1,11 @@ Version History =============== -Version 0.9.10 (unreleased) ---------------------------- +Version 0.10.0 +-------------- * Fix link to polib. (#277, thanks @gamboz) * Deepl: use the PRO API endpoint when using a PRO API key. (#278, thanks @nullcode) +* Limit supported versions to Django 4.2 and 5.0, using Python 3.9, 3.10, 3.11 and 3.12 Version 0.9.9 diff --git a/docs/conf.py b/docs/conf.py index e21eca1..b62f5ae 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -73,7 +73,7 @@ release = get_version() # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: diff --git a/pyproject.toml b/pyproject.toml index 9a9c3de..7e03953 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ order_by_type = true known_django = "django" known_django_third_party = "django_*" known_first_party = "apps,rosetta" -sections = "FUTURE,STDLIB,THIRDPARTY,DJANGO,DJANGO_THIRD_PARTY,REST_FRAMEWORK,FIRSTPARTY,LOCALFOLDER" +sections = "FUTURE,STDLIB,THIRDPARTY,DJANGO,DJANGO_THIRD_PARTY,FIRSTPARTY,LOCALFOLDER" skip_glob= "**/migrations/**" diff --git a/rosetta/__init__.py b/rosetta/__init__.py index 6c5b9d3..ab09801 100644 --- a/rosetta/__init__.py +++ b/rosetta/__init__.py @@ -1,12 +1,4 @@ -try: - import django - - if django.VERSION[:3] <= (3, 2, 0): - default_app_config = "rosetta.apps.RosettaAppConfig" -except ImportError: - pass - -VERSION = (0, 9, 10) +VERSION = (0, 10, 0) def get_version(limit=3): diff --git a/rosetta/tests/tests.py b/rosetta/tests/tests.py index f1d43aa..ece2fc6 100644 --- a/rosetta/tests/tests.py +++ b/rosetta/tests/tests.py @@ -5,6 +5,8 @@ import shutil from unittest import mock from urllib.parse import urlencode +import vcr + from django import VERSION from django.conf import settings from django.core.exceptions import ImproperlyConfigured @@ -15,7 +17,6 @@ from django.test.client import Client from django.urls import resolve, reverse from django.utils.encoding import force_bytes -import vcr from rosetta import views from rosetta.poutil import find_pos from rosetta.signals import entry_changed, post_save diff --git a/setup.py b/setup.py index e8a1cf4..ec01032 100644 --- a/setup.py +++ b/setup.py @@ -52,19 +52,16 @@ setup( "Topic :: Software Development :: Localization", "Topic :: Software Development :: Internationalization", "Framework :: Django", - "Framework :: Django :: 3.0", - "Framework :: Django :: 3.1", - "Framework :: Django :: 3.2", - "Framework :: Django :: 4.0", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], include_package_data=True, zip_safe=False, - install_requires=["Django >= 2.2", "requests >= 2.1.0", "polib >= 1.1.0"], + install_requires=["Django >= 4.2", "requests >= 2.30.0", "polib >= 1.1.0"], tests_require=["tox", "vcrpy"], cmdclass={"test": Tox}, ) diff --git a/testproject/settings.py b/testproject/settings.py index 0276dd3..c45aa7a 100644 --- a/testproject/settings.py +++ b/testproject/settings.py @@ -1,8 +1,6 @@ import os import sys -import django - SITE_ID = 1 @@ -17,22 +15,13 @@ DATABASES = { } } -if django.VERSION[:3] >= (3, 2, 0): - CACHES = { - "default": { - "BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache", - "LOCATION": "127.0.0.1:11211", - "KEY_PREFIX": "ROSETTA_TEST", - } - } -else: - CACHES = { - "default": { - "BACKEND": "django.core.cache.backends.memcached.MemcachedCache", - "LOCATION": "127.0.0.1:11211", - "KEY_PREFIX": "ROSETTA_TEST", - } +CACHES = { + "default": { + "BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache", + "LOCATION": "127.0.0.1:11211", + "KEY_PREFIX": "ROSETTA_TEST", } +} # CACHES = {'default': {'BACKEND': 'django.core.cache.backends.dummy.DummyCache'}} @@ -52,11 +41,9 @@ INSTALLED_APPS = [ "django.contrib.sites", "django.contrib.messages", "rosetta", + "rosetta.tests.test_app.apps.TestAppConfig", ] -if django.VERSION[0:2] >= (1, 7): - INSTALLED_APPS.append("rosetta.tests.test_app.apps.TestAppConfig") - LANGUAGE_CODE = "en" MIDDLEWARE = ( @@ -84,8 +71,6 @@ SILENCED_SYSTEM_CHECKS = ["translation.E002"] LOCALE_PATHS = [os.path.join(PROJECT_PATH, "locale")] -SOUTH_TESTS_MIGRATE = False - FIXTURE_DIRS = (os.path.join(PROJECT_PATH, "fixtures"),) STATIC_URL = "/static/" ROOT_URLCONF = "testproject.urls" @@ -112,6 +97,8 @@ TEMPLATES = [ } ] +USE_TZ = True + STATIC_URL = "/static/" # SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies" diff --git a/tox.ini b/tox.ini index 6bdf633..dd04665 100644 --- a/tox.ini +++ b/tox.ini @@ -1,16 +1,18 @@ [tox] envlist = flake8, - py{38,39,310}-django{32,40,41,42}, + py{38,39,310}-django42, + py{310,311,312}-django50, gettext, docs [gh-actions] python = - 3.10: py310-django32, py310-django40, py310-django41, py310-django42 - 3.9: py39-django32, py39-django40, py39-django41, py39-django42 - 3.8: py38-django32, py38-django40, py38-django41, py38-django42 + 3.12: py312-django50 + 3.11: py311-django42, py311-django50 + 3.10: py310-django42, py310-django50 + 3.9: py39-django42 skipsdist = True @@ -27,10 +29,8 @@ setenv = PYTHONDONTWRITEBYTECODE=1 deps = - django32: Django>=3.2,<=3.2.99 - django40: Django>=4.0,<4.1 - django41: Django>=4.1a,<4.2 django42: Django>=4.2a,<4.3 + django50: Django>=5.0,<5.1 pymemcache requests From 13bbfbc86f6a6b8b230a0242985ece7470cced65 Mon Sep 17 00:00:00 2001 From: Marco Bonetti Date: Mon, 4 Dec 2023 16:48:54 +0100 Subject: [PATCH 16/19] update copyright notice --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 48ad830..71cca5a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2008-2010 Marco Bonetti +Copyright (c) 2008-2023 Marco Bonetti Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation From c4d88c5e568eb9c66eb86a65ee33cce603579769 Mon Sep 17 00:00:00 2001 From: Marco Bonetti Date: Mon, 4 Dec 2023 16:55:11 +0100 Subject: [PATCH 17/19] Update information on supported versions --- README.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 0204e96..7b2012c 100644 --- a/README.rst +++ b/README.rst @@ -16,7 +16,11 @@ Rosetta is a `Django `_ application that facilita Because it doesn't export any models, Rosetta doesn't create any tables in your project's database. Rosetta can be installed and uninstalled by simply adding and removing a single entry in your project's `INSTALLED_APPS` and a single line in your main ``urls.py`` file. -Note: as of version 0.9.0, django-rosetta requires Django 1.11 or later, as of version 0.9.6, django-rosetta requires Django 2.2 or later, and as of version 0.9.9 django-rosetta supports Django 3.2 or later. +Note: +* As of version 0.9.0, django-rosetta requires Django 1.11 or later, +* As of version 0.9.6, django-rosetta requires Django 2.2 or later, +* As of version 0.9.9 django-rosetta supports Django 3.2 or later. +* As of version 0.10.0, django-rosetta requires Django 4.2 or later ******** Features From e607feb5ce1a82f1b0e3d8cd1f02f8ecdc4dbdb2 Mon Sep 17 00:00:00 2001 From: Marco Bonetti Date: Mon, 4 Dec 2023 16:55:45 +0100 Subject: [PATCH 18/19] Update information on supported versions --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 7b2012c..d7ff9ad 100644 --- a/README.rst +++ b/README.rst @@ -17,6 +17,7 @@ Rosetta is a `Django `_ application that facilita Because it doesn't export any models, Rosetta doesn't create any tables in your project's database. Rosetta can be installed and uninstalled by simply adding and removing a single entry in your project's `INSTALLED_APPS` and a single line in your main ``urls.py`` file. Note: + * As of version 0.9.0, django-rosetta requires Django 1.11 or later, * As of version 0.9.6, django-rosetta requires Django 2.2 or later, * As of version 0.9.9 django-rosetta supports Django 3.2 or later. From 260eb1681f6892faf0ca36c7d79b91584e64696f Mon Sep 17 00:00:00 2001 From: Marco Bonetti Date: Mon, 4 Dec 2023 16:56:11 +0100 Subject: [PATCH 19/19] Update information on supported versions --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index d7ff9ad..83dd5ad 100644 --- a/README.rst +++ b/README.rst @@ -18,9 +18,9 @@ Because it doesn't export any models, Rosetta doesn't create any tables in your Note: -* As of version 0.9.0, django-rosetta requires Django 1.11 or later, -* As of version 0.9.6, django-rosetta requires Django 2.2 or later, -* As of version 0.9.9 django-rosetta supports Django 3.2 or later. +* As of version 0.9.0, django-rosetta requires Django 1.11 or later +* As of version 0.9.6, django-rosetta requires Django 2.2 or later +* As of version 0.9.9 django-rosetta supports Django 3.2 or later * As of version 0.10.0, django-rosetta requires Django 4.2 or later ********