diff -r f38db5003acc django/template/context.py
a
|
b
|
|
19 | 19 | dict_ = dict_ or {} |
20 | 20 | self.dicts = [dict_] |
21 | 21 | |
22 | | def __copy__(self): |
23 | | duplicate = self._new() |
24 | | duplicate.dicts = [dict_ for dict_ in self.dicts] |
| 22 | def copy(self): |
| 23 | duplicate = copy(self) |
| 24 | duplicate.dicts = self.dicts[:] |
25 | 25 | return duplicate |
26 | 26 | |
27 | 27 | def __repr__(self): |
… |
… |
|
31 | 31 | for d in reversed(self.dicts): |
32 | 32 | yield d |
33 | 33 | |
34 | | def _new(self): |
35 | | return self.__class__() |
36 | | |
37 | 34 | def push(self): |
38 | 35 | d = {} |
39 | 36 | self.dicts.append(d) |
… |
… |
|
83 | 80 | self.render_context = RenderContext() |
84 | 81 | super(Context, self).__init__(dict_) |
85 | 82 | |
86 | | def __copy__(self): |
87 | | duplicate = super(Context, self).__copy__() |
| 83 | def copy(self): |
| 84 | duplicate = super(Context, self).copy() |
88 | 85 | duplicate.render_context = copy(self.render_context) |
89 | 86 | return duplicate |
90 | 87 | |
91 | | def _new(self): |
92 | | return self.__class__(autoescape=self.autoescape, |
93 | | current_app=self.current_app, |
94 | | use_l10n=self.use_l10n) |
95 | | |
96 | 88 | def update(self, other_dict): |
97 | 89 | "Pushes other_dict to the stack of dictionaries in the Context" |
98 | 90 | if not hasattr(other_dict, '__getitem__'): |
… |
… |
|
168 | 160 | processors = tuple(processors) |
169 | 161 | for processor in get_standard_processors() + processors: |
170 | 162 | self.update(processor(request)) |
171 | | |
172 | | def _new(self): |
173 | | return self.__class__(request=HttpRequest(), |
174 | | current_app=self.current_app, |
175 | | use_l10n=self.use_l10n) |
diff -r f38db5003acc django/test/client.py
a
|
b
|
|
97 | 97 | of rendering. |
98 | 98 | """ |
99 | 99 | store.setdefault('templates', []).append(template) |
100 | | store.setdefault('context', ContextList()).append(copy(context)) |
| 100 | store.setdefault('context', ContextList()).append(context.copy()) |
101 | 101 | |
102 | 102 | def encode_multipart(boundary, data): |
103 | 103 | """ |