[Django] #29382: don't call objects with __call__ instantly

10 views
Skip to first unread message

Django

unread,
May 5, 2018, 6:49:20 AM5/5/18
to django-...@googlegroups.com
#29382: don't call objects with __call__ instantly
-------------------------------------------+------------------------
Reporter: alex | Owner: nobody
Type: Uncategorized | Status: new
Component: Template system | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
Some objects have __call__ defined but have sub-attributes.
In my case the wtforms Label object.
I cannot access Label.text because Label is callable and the resulting str
object has not the attribute text.
Please evaluate first the object fully and then check if __call__ is
available. Elsewise the behaviour is inconsistent and confusing.

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

Django

unread,
May 5, 2018, 6:50:40 AM5/5/18
to django-...@googlegroups.com
#29382: don't call objects with __call__ instantly
---------------------------------+--------------------------------------

Reporter: alex | Owner: nobody
Type: Uncategorized | Status: new
Component: Template system | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Description changed by alex:

Old description:

> Some objects have __call__ defined but have sub-attributes.
> In my case the wtforms Label object.
> I cannot access Label.text because Label is callable and the resulting
> str object has not the attribute text.
> Please evaluate first the object fully and then check if __call__ is
> available. Elsewise the behaviour is inconsistent and confusing.

New description:

Some objects have \__call\__ defined but have sub-attributes.


In my case the wtforms Label object.
I cannot access Label.text because Label is callable and the resulting str
object has not the attribute text.

Please evaluate first the object fully and then check if \__call\__ is


available. Elsewise the behaviour is inconsistent and confusing.

--

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

Django

unread,
May 5, 2018, 6:51:20 AM5/5/18
to django-...@googlegroups.com
#29382: don't call objects with __call__ instantly
---------------------------------+--------------------------------------

Reporter: alex | Owner: nobody
Type: Uncategorized | Status: new
Component: Template system | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Description changed by alex:

Old description:

> Some objects have \__call\__ defined but have sub-attributes.


> In my case the wtforms Label object.
> I cannot access Label.text because Label is callable and the resulting
> str object has not the attribute text.

> Please evaluate first the object fully and then check if \__call\__ is


> available. Elsewise the behaviour is inconsistent and confusing.

New description:

Some objects have __ call __ defined but have sub-attributes.


In my case the wtforms Label object.
I cannot access Label.text because Label is callable and the resulting str
object has not the attribute text.

Please evaluate first the object fully and then check if __ call __ is


available. Elsewise the behaviour is inconsistent and confusing.

--

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

Django

unread,
May 5, 2018, 6:52:56 AM5/5/18
to django-...@googlegroups.com
#29382: don't call objects with __call__ instantly
---------------------------------+--------------------------------------

Reporter: alex | Owner: nobody
Type: Uncategorized | Status: new
Component: Template system | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Description changed by alex:

Old description:

> Some objects have __ call __ defined but have sub-attributes.


> In my case the wtforms Label object.
> I cannot access Label.text because Label is callable and the resulting
> str object has not the attribute text.

> Please evaluate first the object fully and then check if __ call __ is


> available. Elsewise the behaviour is inconsistent and confusing.

New description:

Some objects are callable but have sub-attributes.


In my case the wtforms Label object.
I cannot access Label.text because Label is callable and the resulting str
object has not the attribute text.

Please evaluate first the object fully and then check if object is
callable. Elsewise the behaviour is inconsistent and confusing.

Sorry for the changes

--

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

Django

unread,
May 5, 2018, 10:22:44 AM5/5/18
to django-...@googlegroups.com
#29382: don't call objects with __call__ instantly
---------------------------------+--------------------------------------

Reporter: alex | Owner: nobody
Type: Uncategorized | Status: new
Component: Template system | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by Tim Graham):

Is it related to or a duplicate of #29306 and/or #15791. It's not clear to
me exactly how your proposal would work and if it would be backwards
compatible.

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

Django

unread,
May 9, 2018, 4:49:06 AM5/9/18
to django-...@googlegroups.com
#29382: don't call objects with __call__ instantly
---------------------------------+--------------------------------------
Reporter: alex | Owner: nobody
Type: Uncategorized | Status: closed

Component: Template system | Version: 1.11
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Carlton Gibson):

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


Comment:

Closing as duplicate of #29306 and/or #15791.

(`wtforms` should be able to allow marking labels with
`do_not_call_in_templates` to control the behaviour here.)

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

Reply all
Reply to author
Forward
0 new messages