[Django] #24927: django.utils.six and django.utils.encoding both define python_2_unicode_compatible

24 views
Skip to first unread message

Django

unread,
Jun 4, 2015, 4:28:02 PM6/4/15
to django-...@googlegroups.com
#24927: django.utils.six and django.utils.encoding both define
python_2_unicode_compatible
--------------------------------------+--------------------
Reporter: knbk | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Utilities | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+--------------------
`django.utils.six` and `django.utils.encoding` define the exact same
method definition of `python_2_unicode_compatible`, which is not very DRY.
It might be a good idea to replace one of them with a convenience import
of the other.

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

Django

unread,
Jun 4, 2015, 6:37:54 PM6/4/15
to django-...@googlegroups.com
#24927: django.utils.six and django.utils.encoding both define
python_2_unicode_compatible
-------------------------------------+-------------------------------------
Reporter: knbk | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Utilities | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 0
* needs_docs: => 0


Comment:

The function was added to six in 1.9.0, copied from Django's code. PR at
https://github.com/django/django/pull/4784 to have it include one from the
other, I was unsure whether it was better to maintain the function in
encoding.

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

Django

unread,
Jun 4, 2015, 7:40:21 PM6/4/15
to django-...@googlegroups.com
#24927: django.utils.six and django.utils.encoding both define
python_2_unicode_compatible
-------------------------------------+-------------------------------------
Reporter: knbk | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Utilities | Version: master
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 coldmind):

* cc: me@… (added)
* easy: 1 => 0


Comment:

If we're going to use the method from `six`, seems we should to deprecate
import from django utils, and replace imports inside the django code to
use `six` import instead of utils.

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

Django

unread,
Jun 4, 2015, 7:43:19 PM6/4/15
to django-...@googlegroups.com
#24927: django.utils.six and django.utils.encoding both define
python_2_unicode_compatible
-------------------------------------+-------------------------------------
Reporter: knbk | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Utilities | Version: master
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 carljm):

I don't think it's worth putting users through a deprecation process on
the import location of `python_2_unicode_compatible`, when we could just
provide a non-deprecated import shim and leave it there until Python 2
support is dropped entirely. That's a lot of hassle for Django users in
order to save us a single import line in `django.utils.encoding`.

I do think it's good to switch to relying on the implementation in `six`.

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

Django

unread,
Jun 4, 2015, 8:04:38 PM6/4/15
to django-...@googlegroups.com
#24927: django.utils.six and django.utils.encoding both define
python_2_unicode_compatible
-------------------------------------+-------------------------------------
Reporter: knbk | Owner: MarkusH
Type: | Status: assigned
Cleanup/optimization |
Component: Utilities | Version: master
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 MarkusH):

* owner: nobody => MarkusH
* status: new => assigned


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

Django

unread,
Jun 4, 2015, 8:19:01 PM6/4/15
to django-...@googlegroups.com
#24927: django.utils.six and django.utils.encoding both define
python_2_unicode_compatible
--------------------------------------+------------------------------------
Reporter: knbk | Owner: MarkusH
Type: Cleanup/optimization | Status: assigned
Component: Utilities | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by MarkusH):

* stage: Unreviewed => Accepted


Comment:

PR: https://github.com/django/django/pull/4788

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

Django

unread,
Jun 4, 2015, 8:37:32 PM6/4/15
to django-...@googlegroups.com
#24927: django.utils.six and django.utils.encoding both define
python_2_unicode_compatible
--------------------------------------+------------------------------------
Reporter: knbk | Owner: MarkusH
Type: Cleanup/optimization | Status: assigned
Component: Utilities | Version: master

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

Comment (by carljm):

@markush there was already a PR contributed, see above

--
Ticket URL: <https://code.djangoproject.com/ticket/24927#comment:6>

Django

unread,
Jun 4, 2015, 8:41:23 PM6/4/15
to django-...@googlegroups.com
#24927: django.utils.six and django.utils.encoding both define
python_2_unicode_compatible
-------------------------------------+-------------------------------------
Reporter: knbk | Owner: MarkusH
Type: | Status: assigned
Cleanup/optimization |
Component: Utilities | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/24927#comment:7>

Django

unread,
Jun 5, 2015, 2:38:46 AM6/5/15
to django-...@googlegroups.com
#24927: django.utils.six and django.utils.encoding both define
python_2_unicode_compatible
-------------------------------------+-------------------------------------
Reporter: knbk | Owner: MarkusH
Type: | Status: assigned
Cleanup/optimization |
Component: Utilities | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by MarkusH):

Oh, missed that. Thanks Carl.

--
Ticket URL: <https://code.djangoproject.com/ticket/24927#comment:8>

Django

unread,
Jun 5, 2015, 6:40:55 AM6/5/15
to django-...@googlegroups.com
#24927: django.utils.six and django.utils.encoding both define
python_2_unicode_compatible
--------------------------------------+------------------------------------
Reporter: knbk | Owner: MarkusH
Type: Cleanup/optimization | Status: assigned
Component: Utilities | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1
* stage: Ready for checkin => Accepted


Comment:

I agree, let's drop our version and import six'. As Carl said on the PR a
comment explaining the import is needed.

--
Ticket URL: <https://code.djangoproject.com/ticket/24927#comment:9>

Django

unread,
Jun 5, 2015, 8:42:31 AM6/5/15
to django-...@googlegroups.com
#24927: django.utils.six and django.utils.encoding both define
python_2_unicode_compatible
--------------------------------------+------------------------------------
Reporter: knbk | Owner: MarkusH
Type: Cleanup/optimization | Status: closed
Component: Utilities | Version: master
Severity: Normal | Resolution: fixed

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

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"c91bc68e9a5f9f1e2cce00d01d62d16a858155f0" c91bc68]:
{{{
#!CommitTicketReference repository=""
revision="c91bc68e9a5f9f1e2cce00d01d62d16a858155f0"
Fixed #24927 -- Used python_2_unicode_compatible from six
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24927#comment:10>

Reply all
Reply to author
Forward
0 new messages