[Django] #16383: More specific errors when resolving template Variables

23 views
Skip to first unread message

Django

unread,
Jun 30, 2011, 11:33:25 AM6/30/11
to django-...@googlegroups.com
#16383: More specific errors when resolving template Variables
-------------------------------------------------+-------------------------
Reporter: maraujop | Owner:
Type: New feature | maraujop
Milestone: | Status: new
Version: 1.3 | Component:
Keywords: _resolve_lookup, resolve, template, | Template system
variable, exception | Severity: Normal
Has patch: 1 | Triage Stage:
UI/UX: 0 | Unreviewed
| Easy pickings: 0
-------------------------------------------------+-------------------------
When resolving a template variable that calls an object method/property.
If that method/property has errors we get a `VariableDoesNotExist`
exception without what errors happened, which might confuse the user.

My patch raises the same exception, with related error information. I
wasn't sure what type of Exception raise and probably the exception
message is not the best one.

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

Django

unread,
Jun 30, 2011, 11:34:19 AM6/30/11
to django-...@googlegroups.com
#16383: More specific errors when resolving template Variables
-------------------------------------+-------------------------------------
Reporter: maraujop | Owner: maraujop
Type: New | Status: new
feature | Component: Template system
Milestone: | Severity: Normal
Version: 1.3 | Keywords: _resolve_lookup,
Resolution: | resolve, template, variable,
Triage Stage: | exception
Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by maraujop):

* cc: maraujop (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


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

Django

unread,
Jul 7, 2011, 7:09:08 AM7/7/11
to django-...@googlegroups.com
#16383: More specific errors when resolving template Variables
-------------------------------------+-------------------------------------
Reporter: maraujop | Owner: maraujop
Type: New | Status: new
feature | Component: Template system
Milestone: | Severity: Normal
Version: 1.3 | Keywords: _resolve_lookup,
Resolution: | resolve, template, variable,
Triage Stage: Accepted | exception
Needs documentation: 0 | Has patch: 1
Patch needs improvement: 0 | Needs tests: 1
UI/UX: 0 | Easy pickings: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* needs_tests: 0 => 1
* stage: Unreviewed => Accepted


Comment:

Overall, I like the idea of raising more specific errors.

See also #6907 and #11421.

It would be useful to discuss the details on django-developers.

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

Django

unread,
Sep 20, 2012, 8:47:33 PM9/20/12
to django-...@googlegroups.com
#16383: More specific errors when resolving template Variables
-------------------------------------+-------------------------------------
Reporter: maraujop | Owner: maraujop
Type: New feature | Status: new
Component: Template system | Version: 1.3
Severity: Normal | Resolution:
Keywords: _resolve_lookup, | Triage Stage: Accepted
resolve, template, variable, | Needs documentation: 0
exception | Patch needs improvement: 0
Has patch: 1 | UI/UX: 0
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by CollinAnderson):

I ran into this one today. The patch would fix it for me. I was trying to
do {{ form.errors }} (errors is a @property), and my validation code
caused an AttributeError. I didn't need to call form.is_valid() in the
view.

So, actually, if we know for sure that the object in the context (current)
does indeed have that attribute (bit), then we should really just re-raise
the original exception.

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

Django

unread,
Jun 15, 2014, 3:40:38 AM6/15/14
to django-...@googlegroups.com
#16383: More specific errors when resolving template Variables
-------------------------------------+-------------------------------------
Reporter: maraujop | Owner:
Type: New feature | anubhav9042
Component: Template system | Status: assigned

Severity: Normal | Version: 1.3
Keywords: _resolve_lookup, | Resolution:
resolve, template, variable, | Triage Stage: Accepted
exception | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by anubhav9042):

* status: new => assigned
* owner: maraujop => anubhav9042


Comment:

I will work on this in my GSoC project.

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

Django

unread,
Jun 15, 2014, 3:41:03 AM6/15/14
to django-...@googlegroups.com
#16383: More specific errors when resolving template Variables
-------------------------------------+-------------------------------------
Reporter: maraujop | Owner:

Type: New feature | anubhav9042
Component: Template system | Status: assigned
Severity: Normal | Version: master

Keywords: _resolve_lookup, | Resolution:
resolve, template, variable, | Triage Stage: Accepted
exception | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by anubhav9042):

* version: 1.3 => master


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

Django

unread,
Jul 16, 2014, 1:52:00 PM7/16/14
to django-...@googlegroups.com
#16383: More specific errors when resolving template Variables
-------------------------------------+-------------------------------------
Reporter: maraujop | Owner:

Type: New feature | anubhav9042
Component: Template system | Status: assigned
Severity: Normal | Version: master
Keywords: _resolve_lookup, | Resolution:
resolve, template, variable, | Triage Stage: Accepted
exception | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by timo):

* cc: timo (added)


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

Django

unread,
Jul 26, 2014, 2:47:34 PM7/26/14
to django-...@googlegroups.com
#16383: More specific errors when resolving template Variables
-------------------------------------+-------------------------------------
Reporter: maraujop | Owner:

Type: New feature | anubhav9042
Component: Template system | Status: assigned
Severity: Normal | Version: master
Keywords: _resolve_lookup, | Resolution:
resolve, template, variable, | Triage Stage: Accepted
exception | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by anubhav9042):

* needs_tests: 1 => 0


Comment:

https://github.com/django/django/pull/2979

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

Django

unread,
Jul 29, 2014, 9:07:50 AM7/29/14
to django-...@googlegroups.com
#16383: More specific errors when resolving template Variables
-------------------------------------+-------------------------------------
Reporter: maraujop | Owner:

Type: New feature | anubhav9042
Component: Template system | Status: assigned
Severity: Normal | Version: master
Keywords: _resolve_lookup, | Resolution:
resolve, template, variable, | Triage Stage: Accepted
exception | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by hirokiky):

* cc: hirokiky@… (added)


Comment:

this pull-request is focus when some property raise `AttributeError`,
right?
I just commented about problem on the surface.

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

Django

unread,
Jul 29, 2014, 11:42:30 AM7/29/14
to django-...@googlegroups.com
#16383: More specific errors when resolving template Variables
-------------------------------------+-------------------------------------
Reporter: maraujop | Owner:

Type: New feature | anubhav9042
Component: Template system | Status: assigned
Severity: Normal | Version: master
Keywords: _resolve_lookup, | Resolution:
resolve, template, variable, | Triage Stage: Accepted
exception | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by anubhav9042):

Yep.
If a property raises AttributeError, so it occured as if property didn't
existed...so I checked that.

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

Django

unread,
Jul 31, 2014, 9:22:10 AM7/31/14
to django-...@googlegroups.com
#16383: More specific errors when resolving template Variables
-------------------------------------+-------------------------------------
Reporter: maraujop | Owner:
Type: New feature | anubhav9042
Component: Template system | Status: closed
Severity: Normal | Version: master
Keywords: _resolve_lookup, | Resolution: fixed

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

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


Comment:

In [changeset:"0dd05c9e66ebb5cb97136f84373f43582783e1a6"]:
{{{
#!CommitTicketReference repository=""
revision="0dd05c9e66ebb5cb97136f84373f43582783e1a6"
Fixed #16383 -- Raised the AttributeError raised in property of an object
when used in a template.

Thanks maraujop for the report and Hiroki and Tim Graham for review.
}}}

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

Reply all
Reply to author
Forward
0 new messages