Changes between Initial Version and Version 1 of Ticket #32316


Ignore:
Timestamp:
Jan 4, 2021, 2:42:22 PM (4 years ago)
Author:
William Schwartz
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32316 – Description

    initial v1  
    1414== Proposed fixes
    1515
    16 I have pushed PR GH-XXXX to address the four of those modules other than `trans_real`. I dealt with each module's use of `__file__`  in separate commits to make them easier to discuss and separate/cherry-pick if needed. Below I link to the individual commits as I discuss each of the four modules. These first two are fairly easy, but the second two may require further consideration.
     16I have pushed [https://github.com/django/django/pull/13841 PR GH-13841] to address the four of those modules other than `trans_real`. I dealt with each module's use of `__file__`  in separate commits to make them easier to discuss and separate/cherry-pick if needed. Below I link to the individual commits as I discuss each of the four modules. These first two are fairly easy, but the second two may require further consideration.
    1717
    18 === `django.forms.renders` ([https://github.com/wkschwartz/django/commit/54d539c8becbd6d4cfc5bcf01c1be64acd34568d 54d539c])
     18=== `django.forms.renders` ([https://github.com/django/django/pull/13841/commits/54d539c8becbd6d4cfc5bcf01c1be64acd34568d 54d539c])
    1919Remove the undocumented module constant `ROOT` and replace its single use.
    2020
    21 === `django.utils.version` ([https://github.com/wkschwartz/django/commit/f4edc6e412df87e05ed224525ebf1355410fe268 f4edc6e])
     21=== `django.utils.version` ([https://github.com/django/django/pull/13841/commits/f4edc6e412df87e05ed224525ebf1355410fe268 f4edc6e])
    2222Treat the lack of module-global `__file__` the same as a failure of `git log` by returning `None` from `get_git_changeset`.
    2323
    24 === `django.views.debug` ([https://github.com/wkschwartz/django/commit/07f46b7b26a1a74fa531de834bee240d576b7f85 07f46b7])
     24=== `django.views.debug` ([https://github.com/django/django/pull/13841/commits/07f46b7b26a1a74fa531de834bee240d576b7f85 07f46b7])
    2525The module-level constant `CURRENT_DIR` is used only in the module itself and is undocumented, so I'm assuming it's an obscure private symbol that no one will miss. I've replaced it with a module-level private function `_builtin_template_path` that refactors and centralizes finding built-in templates for the entire module.
    2626
    2727The one tricky part is that #32105 added the `html_template_path` and `text_template_path` attributes `django.views.debug.ExceptionReporter`. I didn't want to disturb #32105's goal of making the template paths easily override-able, so I avoided calling `_builtin_template_path` in the class definition by making detecting the presence of the attributes in `__init__` and setting defaults there. Alternatives include making the attributes properties with setters or cached properties without setters.
    2828
    29 === `django.contrib.auth.password_validation` ([https://github.com/wkschwartz/django/commit/24aa80ba413eeaaec0f3c2cab2f028e0dcbaf99b 24aa80b])
     29=== `django.contrib.auth.password_validation` ([https://github.com/django/django/pull/13841/commits/24aa80ba413eeaaec0f3c2cab2f028e0dcbaf99b 24aa80b])
    3030The `CommonPasswordValidator`-class constant `DEFAULT_PASSWORD_LIST_PATH` is used only in one place, the class's instance constructor. While the nature of `DEFAULT_PASSWORD_LIST_PATH` is not documented, its existence is inside the docs for the [https://docs.djangoproject.com/en/3.1/topics/auth/passwords/#django.contrib.auth.password_validation.CommonPasswordValidator constructor's signature]. I've changed `DEFAULT_PASSWORD_LIST_PATH` from a class constant into an instance attribute. Another possibility is making `DEFAULT_PASSWORD_LIST_PATH` be a `django.utils.functional.classproperty`.
Back to Top