Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#12070 closed (fixed)

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

Reported by: emulbreh 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 5 years ago.
Patch (Unindented '...'s to match style in other doctests)

Download all attachments as: .zip

Change History (7)

comment:1 Changed 5 years ago by russellm

  • milestone set to 1.2
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 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 5 years ago by alexdutton

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

comment:3 Changed 5 years ago by Alex

  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 5 years ago by jkocherhans

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:5 Changed 5 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 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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