[Django] #28163: Make the default settings.py pass pep8

22 views
Skip to first unread message

Django

unread,
May 2, 2017, 11:15:13 PM5/2/17
to django-...@googlegroups.com
#28163: Make the default settings.py pass pep8
------------------------------------------------+------------------------
Reporter: Yoni Lavi | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
For most Django projects I see, everything passes pep8 checks except for
migrations and the default settings.py file. Migrations aren't really
source code, so I don't care about that, but it should be easy to make
settings.py conform to all the rules.

From what I checked, by changing the AUTH_PASSWORD_VALIDATORS to fit in
under 80 cols, the entire default file should now pass validation, so I
suggest the following comprehension for the validators (Pull Request -
https://github.com/django/django/pull/8452):

{{{#!python
AUTH_PASSWORD_VALIDATORS = [
{'NAME': 'django.contrib.auth.password_validation.%s' % validator}
for validator in [
'UserAttributeSimilarityValidator',
'MinimumLengthValidator',
'CommonPasswordValidator',
'NumericPasswordValidator',
]
]
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28163>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 3, 2017, 7:27:13 AM5/3/17
to django-...@googlegroups.com
#28163: Make the default settings.py pass pep8
-------------------------------------+-------------------------------------

Reporter: Yoni Lavi | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Uncategorized | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Arne de Laat):

This change makes it a bit more difficult to add `OPTIONS` to one of the
validators, as shown in the example:
https://docs.djangoproject.com/en/dev/topics/auth/passwords/#enabling-
password-validation
Or to add a validator not in `django.contrib.auth.password_validation`.

--
Ticket URL: <https://code.djangoproject.com/ticket/28163#comment:1>

Django

unread,
May 3, 2017, 7:35:16 AM5/3/17
to django-...@googlegroups.com
#28163: Make the default settings.py pass pep8
-------------------------------------+-------------------------------------

Reporter: Yoni Lavi | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* component: Uncategorized => Core (Other)


Comment:

Agreed, I'm not so happy to obfuscate the settings merely to limit line
length.

--
Ticket URL: <https://code.djangoproject.com/ticket/28163#comment:2>

Django

unread,
May 3, 2017, 7:51:33 AM5/3/17
to django-...@googlegroups.com
#28163: Make the default settings.py pass pep8
-------------------------------------+-------------------------------------

Reporter: Yoni Lavi | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Core (Other) | Version: 1.11
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* status: new => closed
* resolution: => wontfix


Comment:

The 80-chars limit of pep8 is controversial. Many projects customize it to
a greater length. Readability and usability come first.

--
Ticket URL: <https://code.djangoproject.com/ticket/28163#comment:3>

Django

unread,
Jul 23, 2017, 9:07:48 PM7/23/17
to django-...@googlegroups.com
#28163: Make the default settings.py pass pep8
-------------------------------------+-------------------------------------

Reporter: Yoni Lavi | Owner: nobody
Type: | Status: new

Cleanup/optimization |
Component: Core (Other) | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Yoni Lavi):

* status: closed => new
* resolution: wontfix =>


Comment:

Hi folks,
I'm sorry to rehash this, but the current validator verbosity keeps
bugging me on my own projects and I'm sure I'm not the only one. So I just
wanted to ask if you would be open to a more flexible approach such as
using this sort of utility function (to be included in django.utils?):

{{{#!python
def basic_password_validator(class_name, **kwargs):
MODULE_PATH = 'django.contrib.auth.password_validation.'
validator = {'NAME': '.'.join(MODULE_PATH, class_name)}
validator.update(kwargs)
return validator


AUTH_PASSWORD_VALIDATORS = [
basic_password_validator('UserAttributeSimilarityValidator'),
basic_password_validator('MinimumLengthValidator',
OPTIONS={'min_length': 9}),
basic_password_validator('CommonPasswordValidator'),
basic_password_validator('NumericPasswordValidator'),
]
}}}

So I'm just looking for feedback about whether this sort of approach might
be deemed acceptable, and if so whether you have advice about the specific
implementation. If not, I promise to stop spamming this ticket :)

--
Ticket URL: <https://code.djangoproject.com/ticket/28163#comment:4>

Django

unread,
Jul 24, 2017, 9:05:41 AM7/24/17
to django-...@googlegroups.com
#28163: Make the default settings.py pass pep8
-------------------------------------+-------------------------------------

Reporter: Yoni Lavi | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Core (Other) | Version: 1.11
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => wontfix


Comment:

I don't see much difference between that suggestion and the original
proposal. To reconsider a "wontfix" ticket, write to the
DevelopersMailingList rather than reopening the ticket.

--
Ticket URL: <https://code.djangoproject.com/ticket/28163#comment:5>

Reply all
Reply to author
Forward
0 new messages