﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35738	Deprecate double-dot variable lookups	Adam Johnson	David Smith	"Currently, a double-dot variable lookup, like `{{ book..title }}`, is allowed in templates. It maps to a lookup of the empty string before the next lookup of the named attribute.

Supporting double-dot lookups means that when written accidentally, the user gets a silent failure, as for a missing variable, rather than a syntax error. The empty string lookup is unlikely to be used intentionally.

This behaviour is also inconsistent with Python and Jinja, which both raise a syntax error.

Let’s deprecated `..` in Django templates, eventually turning it into a syntax error. We should be able to start by adding the warning in `Variable.__init__`:

{{{#!diff
--- django/template/base.py
+++ django/template/base.py
@@ -842,6 +842,8 @@ def __init__(self, var):
                         ""not begin with underscores: '%s'"" % var
                     )
                 self.lookups = tuple(var.split(VARIABLE_ATTRIBUTE_SEPARATOR))
+                if """" in self.lookups:
+                    warnings.warn(...)
 
     def resolve(self, context):
         """"""Resolve this variable against a given context.""""""
}}}

The warning message should include the template file and line.

This ticket follows [https://forum.djangoproject.com/t/deprecate-in-template-variable-lookups/34180 this forum discussion], where Carlton +1'd me on the concept."	Cleanup/optimization	closed	Template system	dev	Normal	fixed		Sanjeev Holla S David Smith	Ready for checkin	1	0	0	0	0	0
