[Django] #26250: Use a single string placeholder syntax for all user facing APIs

5 views
Skip to first unread message

Django

unread,
Feb 20, 2016, 12:38:36 PM2/20/16
to django-...@googlegroups.com
#26250: Use a single string placeholder syntax for all user facing APIs
--------------------------------------+--------------------
Reporter: jdufresne | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
Some Django APIs use the legacy % style placeholder syntax while others
use the {{{str.format()}}} style syntax.

I think Django should pick one style and use it consistently for all user
facing APIs.

For example:

{{{str.format()}}} syntax

* [https://docs.djangoproject.com/en/1.9/ref/class-based-views/mixins-
editing/#django.views.generic.edit.ModelFormMixin.success_url success_url]
*
[https://docs.djangoproject.com/en/1.9/ref/utils/#django.utils.html.format_html
format_html()]

Legacy % syntax

* [https://docs.djangoproject.com/en/1.9/ref/forms/validation/#raising-
validationerror ValidationError]
* [https://docs.djangoproject.com/en/1.9/topics/db/models/#be-careful-
with-related-name related_name]

As {{{success_url}}} recently moved to {{{str.format()}}}, I'm guessing
this is Django's preferred style?

I'm suggesting Django deprecate its use of the legacy % syntax in favor of
{{{str.format()}}} syntax. I think this would create a greater API
consistency throughout the framework.

[https://groups.google.com/forum/#!topic/django-developers/J9CfWIgrgbY
django-developers discussion]

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

Django

unread,
Feb 22, 2016, 11:49:26 AM2/22/16
to django-...@googlegroups.com
#26250: Use a single string placeholder syntax for all user facing APIs
-------------------------------------+-------------------------------------
Reporter: jdufresne | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* stage: Unreviewed => Someday/Maybe
* component: Uncategorized => Core (Other)
* needs_tests: => 0
* needs_docs: => 0


Comment:

Pending outcome of mailing discussion.

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

Django

unread,
Mar 5, 2016, 2:30:44 PM3/5/16
to django-...@googlegroups.com
#26250: Use a single string placeholder syntax for all user facing APIs
-------------------------------------+-------------------------------------
Reporter: jdufresne | Owner: nobody
Type: | Status: closed

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

Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

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


Comment:

In my opinion, the discussion didn't reveal any strong argument in favor
of this move.

Summarizing James Bennett's post:
use format() in future commits if it's cleaner, or just adopt a policy
of "if you're in there making a change and it won't break back compat,
feel free to update to format() while you're at it".

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

Reply all
Reply to author
Forward
0 new messages