Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#28984 closed Cleanup/optimization (fixed)

Assorted code simplifications

Reported by: Дилян Палаузов Owned by: nobody
Component: Core (Other) Version: master
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)

various_shortcuts.patch (11.8 KB) - added by Дилян Палаузов 9 months ago.

Download all attachments as: .zip

Change History (5)

Changed 9 months ago by Дилян Палаузов

Attachment: various_shortcuts.patch added

comment:1 Changed 9 months ago by Tim Graham

Component: UncategorizedCore (Other)
Triage Stage: UnreviewedReady for checkin

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.

comment:2 Changed 9 months ago by Tim Graham

Summary: Various shortcutsAssorted code simplifications

comment:3 Changed 9 months ago by GitHub <noreply@…>

Resolution: fixed
Status: newclosed

In acc8dd4:

Fixed #28984 -- Made assorted code simplifications.

comment:4 Changed 9 months ago by Jon Dufresne

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.
Back to Top