[Django] #27546: Replace hardcoded class names in __repr__-methods

13 views
Skip to first unread message

Django

unread,
Nov 28, 2016, 4:02:36 PM11/28/16
to django-...@googlegroups.com
#27546: Replace hardcoded class names in __repr__-methods
------------------------------------------------+------------------------
Reporter: Mads Jensen | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Uncategorized | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
------------------------------------------------+------------------------
I noticed there are a few places where {{{__repr__}}} does not use
{{{self.__class__.__name__}}}. I think this is a small clean-up that would
make sense to do, but perhaps there was a good reason not to do that
(probably they're never subclassed?). The following output is from grep:

{{{
django/db/models/query.py: return "<RawQuerySet: %s>" % self.query
django/db/models/sql/query.py: return "<RawQuery: %s>" % self
django/db/migrations/state.py: return "<ModelState: '%s.%s'>" %
(self.app_label, self.name)
django/utils/baseconv.py: return "<BaseConverter: base%s (%s)>" %
(len(self.digits), self.digits)
django/core/management/commands/makemessages.py: return
"<TranslatableFile: %s>" % os.sep.join([self.dirpath, self.file])
django/core/serializers/base.py: return "<DeserializedObject:
%s(pk=%s)>" % (
}}}

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

Django

unread,
Nov 28, 2016, 4:33:04 PM11/28/16
to django-...@googlegroups.com
#27546: Replace hardcoded class names in __repr__-methods
--------------------------------------+------------------------------------

Reporter: Mads Jensen | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Other) | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

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

* component: Uncategorized => Core (Other)
* stage: Unreviewed => Accepted


Comment:

Sure, while there it would be nice to add tests if missing.

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

Django

unread,
Nov 28, 2016, 11:36:10 PM11/28/16
to django-...@googlegroups.com
#27546: Replace hardcoded class names in __repr__-methods
-------------------------------------+-------------------------------------
Reporter: Mads Jensen | Owner: Adiyat
Type: | Mubarak
Cleanup/optimization | Status: assigned

Component: Core (Other) | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Adiyat Mubarak):

* owner: nobody => Adiyat Mubarak
* status: new => assigned


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

Django

unread,
Nov 29, 2016, 1:18:05 AM11/29/16
to django-...@googlegroups.com
#27546: Replace hardcoded class names in __repr__-methods
-------------------------------------+-------------------------------------
Reporter: Mads Jensen | Owner: Adiyat
Type: | Mubarak
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Adiyat Mubarak):

Replying to [ticket:27546 Mads Jensen]:


> I noticed there are a few places where {{{__repr__}}} does not use
{{{self.__class__.__name__}}}. I think this is a small clean-up that would
make sense to do, but perhaps there was a good reason not to do that
(probably they're never subclassed?). The following output is from grep:
>
> {{{
> django/db/models/query.py: return "<RawQuerySet: %s>" %
self.query
> django/db/models/sql/query.py: return "<RawQuery: %s>" % self
> django/db/migrations/state.py: return "<ModelState: '%s.%s'>" %
(self.app_label, self.name)
> django/utils/baseconv.py: return "<BaseConverter: base%s (%s)>" %
(len(self.digits), self.digits)
> django/core/management/commands/makemessages.py: return
"<TranslatableFile: %s>" % os.sep.join([self.dirpath, self.file])
> django/core/serializers/base.py: return "<DeserializedObject:
%s(pk=%s)>" % (
> }}}

Hi, I just learn to contribute on django project by taking this easy task
on this [https://github.com/django/django/pull/7629 PR]
Do I need to update this ticket to `resolve as fixed`? or this ticket will
closed automatically?

Thank in advance

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

Django

unread,
Nov 29, 2016, 2:10:16 AM11/29/16
to django-...@googlegroups.com
#27546: Replace hardcoded class names in __repr__-methods
-------------------------------------+-------------------------------------
Reporter: Mads Jensen | Owner: Adiyat
Type: | Mubarak
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Adiyat Mubarak):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/7629 PR]

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

Django

unread,
Nov 29, 2016, 5:10:37 AM11/29/16
to django-...@googlegroups.com
#27546: Replace hardcoded class names in __repr__-methods
-------------------------------------+-------------------------------------
Reporter: Mads Jensen | Owner: Adiyat
Type: | Mubarak
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mads Jensen):

Ticket will be closed when a maintainer merges the changes and marks it as
solved.

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

Django

unread,
Dec 1, 2016, 8:39:10 AM12/1/16
to django-...@googlegroups.com
#27546: Replace hardcoded class names in __repr__-methods
-------------------------------------+-------------------------------------
Reporter: Mads Jensen | Owner: Adiyat
Type: | Mubarak
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"794b7d803359c7d510910361f4d92429b43d0e79" 794b7d80]:
{{{
#!CommitTicketReference repository=""
revision="794b7d803359c7d510910361f4d92429b43d0e79"
Refs #27546 -- Tested some __repr__() methods.
}}}

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

Django

unread,
Dec 1, 2016, 8:39:10 AM12/1/16
to django-...@googlegroups.com
#27546: Replace hardcoded class names in __repr__-methods
-------------------------------------+-------------------------------------
Reporter: Mads Jensen | Owner: Adiyat
Type: | Mubarak
Cleanup/optimization | Status: closed

Component: Core (Other) | Version: 1.10
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

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


Comment:

In [changeset:"48826aa541f3a043690b90aa96f3fc07b7bc9fa9" 48826aa]:
{{{
#!CommitTicketReference repository=""
revision="48826aa541f3a043690b90aa96f3fc07b7bc9fa9"
Fixed #27546 -- Removed hardcoded class names in __repr__() methods.
}}}

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

Django

unread,
Feb 4, 2017, 12:22:39 PM2/4/17
to django-...@googlegroups.com
#27546: Replace hardcoded class names in __repr__-methods
-------------------------------------+-------------------------------------
Reporter: Mads Jensen | Owner: Adiyat
Type: | Mubarak
Cleanup/optimization | Status: closed
Component: Core (Other) | Version: 1.10
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"86ae1d51ed949c30b435b0dc9923c4da15cbcfd0" 86ae1d51]:
{{{
#!CommitTicketReference repository=""
revision="86ae1d51ed949c30b435b0dc9923c4da15cbcfd0"
Refs #27546 -- Removed hardcoded class names in __repr__() methods.
}}}

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

Django

unread,
Oct 5, 2017, 11:29:59 AM10/5/17
to django-...@googlegroups.com
#27546: Replace hardcoded class names in __repr__-methods
-------------------------------------+-------------------------------------
Reporter: Mads Jensen | Owner: Adiyat
Type: | Mubarak
Cleanup/optimization | Status: closed
Component: Core (Other) | Version: 1.10
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"ee7ab1b6e2439f79f3594925a6bf539aabaec8e1" ee7ab1b6]:
{{{
#!CommitTicketReference repository=""
revision="ee7ab1b6e2439f79f3594925a6bf539aabaec8e1"
Refs #27546 -- Replaced hardcoded class name in ForNode.__repr__().
}}}

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

Reply all
Reply to author
Forward
0 new messages