Code

Ticket #3192: dict-from-context-processor.diff

File dict-from-context-processor.diff, 553 bytes (added by Jeremy Dunck <jdunck@…>, 8 years ago)
Line 
1Index: template/context.py
2===================================================================
3--- template/context.py (revision 4248)
4+++ template/context.py (working copy)
5@@ -94,4 +94,7 @@
6         else:
7             processors = tuple(processors)
8         for processor in get_standard_processors() + processors:
9-            self.update(processor(request))
10+            d = processor(request)
11+            if not hasattr(d, '__getitem__'):
12+                raise TypeError, 'Dictionary expected from context processor.'
13+            self.update(d)