Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#12070 closed (fixed)

Variable("a._hidden") does not raise TemplateSyntaxError

Reported by: Johannes Dollinger Owned by: alexdutton
Component: Template system Version: 1.1
Severity: Keywords: variable, filterexpression, private, underscore
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

>>> Variable("a._hidden")
<Variable: 'a._hidden'>
>>> FilterExpression("a._hidden", p)
...
TemplateSyntaxError: Variables and attributes may not begin with underscores: 'a._hidden'

This should be consistent.

Attachments (1)

patch-12070.diff (2.1 KB) - added by alexdutton 7 years ago.
Patch (Unindented '...'s to match style in other doctests)

Download all attachments as: .zip

Change History (7)

comment:1 Changed 7 years ago by Russell Keith-Magee

milestone: 1.2
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 7 years ago by alexdutton

Has patch: set
Owner: changed from nobody to alexdutton

Attached patch with two new doctests in regressiontests/templates/parser.py.

Moved the check for '._' from FilterExpression to Variable, given the former calls the latter.

No documentation needed; (hopefully ready for check-in)

Changed 7 years ago by alexdutton

Attachment: patch-12070.diff added

Patch (Unindented '...'s to match style in other doctests)

comment:3 Changed 7 years ago by Alex Gaynor

Triage Stage: AcceptedReady for checkin

comment:4 Changed 7 years ago by jkocherhans

Resolution: fixed
Status: newclosed

(In [12539]) Fixed #12070. Fixed a case where var._whatever wasn't raising a TemplateSyntaxError.

comment:5 Changed 7 years ago by jkocherhans

(In [12540]) [1.1.X] Fixed #12070. Fixed a case where var._whatever wasn't raising a TemplateSyntaxError. Backport of r12539 from trunk.

comment:6 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top