#28984 closed Cleanup/optimization (fixed)
Assorted code simplifications
Reported by: | Дилян Палаузов | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Attachments (1)
Change History (5)
by , 7 years ago
Attachment: | various_shortcuts.patch added |
---|
comment:1 by , 7 years ago
Component: | Uncategorized → Core (Other) |
---|---|
Triage Stage: | Unreviewed → Ready for checkin |
comment:2 by , 7 years ago
Summary: | Various shortcuts → Assorted code simplifications |
---|
comment:4 by , 7 years ago
The change in django/contrib/admin/models.py isn't included because besides capitalizing the first character of the string, capitalize() also lower cases the rest of the characters which isn't desired.
capfirst()
may be a suitable alternative:
https://github.com/django/django/blob/2.0.1/django/utils/text.py#L15-L17
Found the pattern repeated in the folowing:
./django/utils/lorem_ipsum.py:68: return '%s%s%s' % (s[0].upper(), s[1:], random.choice('?.')) ./django/template/defaultfilters.py:75: return value and value[0].upper() + value[1:] ./django/contrib/admin/models.py:125: change_message = ' '.join(msg[0].upper() + msg[1:] for msg in messages)
Note:
See TracTickets
for help on using tickets.
PR
The change in django/contrib/admin/models.py isn't included because besides capitalizing the first character of the string,
capitalize()
also lower cases the rest of the characters which isn't desired.