Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#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)

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

Download all attachments as: .zip

Change History (5)

by Дилян Палаузов, 7 years ago

Attachment: various_shortcuts.patch added

comment:1 by Tim Graham, 7 years ago

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 by Tim Graham, 7 years ago

Summary: Various shortcutsAssorted code simplifications

comment:3 by GitHub <noreply@…>, 7 years ago

Resolution: fixed
Status: newclosed

In acc8dd4:

Fixed #28984 -- Made assorted code simplifications.

comment:4 by Jon Dufresne, 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.
Back to Top