You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
945 B
27 lines
945 B
5 years ago
|
From 6179c02c91800d220de03006117afa5e6d60f0f6 Mon Sep 17 00:00:00 2001
|
||
|
From: Peter Harris <pete.alex.harris@gmail.com>
|
||
|
Date: Fri, 23 Jan 2015 10:12:10 +0000
|
||
|
Subject: [PATCH] Replace lambda for 'dict' in with dict itself
|
||
|
|
||
|
lambda **kw: kw is not equivalent to the dict constructor. It is much less useful.
|
||
|
In particular it doesn't accept a sequence of pairs.
|
||
|
Why not put dict itself into the DEFAULT_NAMESPACE?
|
||
|
Principle of least surprise, etc.
|
||
|
---
|
||
|
jinja2/defaults.py | 2 +-
|
||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/jinja2/defaults.py b/jinja2/defaults.py
|
||
|
index a27cb80c..3717a722 100644
|
||
|
--- a/jinja2/defaults.py
|
||
|
+++ b/jinja2/defaults.py
|
||
|
@@ -32,7 +32,7 @@
|
||
|
from jinja2.tests import TESTS as DEFAULT_TESTS
|
||
|
DEFAULT_NAMESPACE = {
|
||
|
'range': range_type,
|
||
|
- 'dict': lambda **kw: kw,
|
||
|
+ 'dict': dict,
|
||
|
'lipsum': generate_lorem_ipsum,
|
||
|
'cycler': Cycler,
|
||
|
'joiner': Joiner
|