Page MenuHomeSoftware Heritage

mailmap: Move feature into a dedicated django application
ClosedPublic

Authored by anlambert on Aug 19 2022, 2:43 PM.

Details

Summary

Move all templates, views, urls and commands related to the mailmap
feature into its dedicated django application.

Please note that the initial migration will not perform any database
operations as the tables have already been created by the swh.web.auth
django application the mailmap feature was previously located at.

Related to T4398

Depends on D8265

Diff Detail

Repository
rDWAPPS Web applications
Branch
django-apps-refactoring-mailmap
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 30908
Build 48339: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 48338: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D8266 (id=29855)

Could not rebase; Attempt merge onto d72784ac65...

Updating d72784ac..f58181ed
Fast-forward
 swh/web/admin/mailmap.py                           |  16 ---
 swh/web/admin/urls.py                              |   1 -
 swh/web/api/apiurls.py                             |   2 +-
 swh/web/api/views/utils.py                         |   2 +-
 swh/web/auth/migrations/0007_mailmap_django_app.py |  29 ++++++
 swh/web/auth/models.py                             | 103 -------------------
 swh/web/auth/views.py                              |  70 ++++++-------
 swh/web/browse/browseurls.py                       |   2 +-
 swh/web/browse/urls.py                             |  14 +--
 swh/web/common/utils.py                            |   3 +
 swh/web/config.py                                  |  10 +-
 swh/web/mailmap/__init__.py                        |   6 ++
 swh/web/mailmap/apps.py                            |  11 +++
 swh/web/{auth => mailmap}/management/__init__.py   |   0
 .../management/commands/__init__.py                |   0
 .../management/commands/sync_mailmaps.py           |   2 +-
 swh/web/mailmap/migrations/0001_initial.py         |  88 +++++++++++++++++
 swh/web/mailmap/migrations/__init__.py             |   0
 swh/web/mailmap/models.py                          | 109 +++++++++++++++++++++
 swh/web/{ => mailmap}/templates/admin/mailmap.html |   0
 swh/web/mailmap/urls.py                            |  38 +++++++
 swh/web/{auth/mailmap.py => mailmap/views.py}      |  30 ++----
 swh/web/settings/common.py                         |  39 ++++++--
 swh/web/templates/layout.html                      |   2 +-
 swh/web/tests/auth/test_migrations.py              |  16 +++
 swh/web/tests/conftest.py                          |  50 ++++++++--
 swh/web/tests/mailmap/__init__.py                  |   0
 swh/web/tests/mailmap/test_app.py                  |  32 ++++++
 swh/web/tests/{auth => mailmap}/test_mailmap.py    |   2 +-
 swh/web/tests/mailmap/test_migrations.py           |  15 +++
 swh/web/tests/test_urls.py                         |  16 ++-
 swh/web/urls.py                                    |  13 ++-
 32 files changed, 507 insertions(+), 214 deletions(-)
 delete mode 100644 swh/web/admin/mailmap.py
 create mode 100644 swh/web/auth/migrations/0007_mailmap_django_app.py
 create mode 100644 swh/web/mailmap/__init__.py
 create mode 100644 swh/web/mailmap/apps.py
 rename swh/web/{auth => mailmap}/management/__init__.py (100%)
 rename swh/web/{auth => mailmap}/management/commands/__init__.py (100%)
 rename swh/web/{auth => mailmap}/management/commands/sync_mailmaps.py (98%)
 create mode 100644 swh/web/mailmap/migrations/0001_initial.py
 create mode 100644 swh/web/mailmap/migrations/__init__.py
 create mode 100644 swh/web/mailmap/models.py
 rename swh/web/{ => mailmap}/templates/admin/mailmap.html (100%)
 create mode 100644 swh/web/mailmap/urls.py
 rename swh/web/{auth/mailmap.py => mailmap/views.py} (89%)
 create mode 100644 swh/web/tests/mailmap/__init__.py
 create mode 100644 swh/web/tests/mailmap/test_app.py
 rename swh/web/tests/{auth => mailmap}/test_mailmap.py (99%)
 create mode 100644 swh/web/tests/mailmap/test_migrations.py
Changes applied before test
commit f58181edb8e859ae621921b002ff0c3b17bca016
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Mon Jul 18 15:59:20 2022 +0200

    mailmap: Move feature into a dedicated django application
    
    Move all templates, views, urls and commands related to the mailmap
    feature into its dedicated django application.
    
    Please note that the initial migration will not perform any database
    operations as the tables have already been created by the swh.web.auth
    django application the mailmap feature was previously located at.
    
    Related to T4398

commit 0306c23d03783a1e5fdc898e76444dd2c534fbea
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Mon Jul 18 15:17:38 2022 +0200

    Update swh-web django applications configuration and setup
    
    Towards reorganizing swh-web features into multiple django applications,
    introduce the following changes regarding their settings:
    
    - Declare a fixed set of base django apps and enable to add extra ones
      through configuration
    
    - Add application templates directory to django templates search paths
    
    - Automatically register URLs of selected django applications
    
    - Inject swh-web django app names in templates to check a feature is enabled
    
    Related to T4398

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1981/ for more details.

This revision is now accepted and ready to land.Aug 19 2022, 5:05 PM