Changeset 5277
- Timestamp:
- 05/17/07 11:55:38 (1 year ago)
- Files:
-
- django/branches/unicode/django/contrib/sitemaps/views.py (modified) (1 diff)
- django/branches/unicode/django/template/__init__.py (modified) (3 diffs)
- django/branches/unicode/django/template/loader.py (modified) (2 diffs)
- django/branches/unicode/django/test/utils.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/unicode/django/contrib/sitemaps/views.py
r5126 r5277 27 27 else: 28 28 urls.extend(site.get_urls()) 29 xml = loader.render_to_string('sitemap.xml', {'urlset': urls} )29 xml = loader.render_to_string('sitemap.xml', {'urlset': urls}, encoding='utf-8') 30 30 return HttpResponse(xml, mimetype='application/xml') django/branches/unicode/django/template/__init__.py
r5230 r5277 177 177 yield subnode 178 178 179 def render(self, context ):179 def render(self, context, encoding=None): 180 180 "Display stage -- can be called many times" 181 return self.nodelist.render(context )181 return self.nodelist.render(context, encoding) 182 182 183 183 def compile_string(template_string, origin): … … 731 731 codec_errors = 'replace' 732 732 733 def render(self, context): 733 def render(self, context, encoding=None): 734 if encoding is None: 735 encoding = settings.DEFAULT_CHARSET 734 736 bits = [] 735 737 for node in self: … … 738 740 else: 739 741 bits.append(node) 740 encoding = settings.DEFAULT_CHARSET741 742 return ''.join([smart_str(b, encoding, errors=self.codec_errors) for b in bits]) 742 743 django/branches/unicode/django/template/loader.py
r4265 r5277 88 88 return Template(source, origin, name) 89 89 90 def render_to_string(template_name, dictionary=None, context_instance=None ):90 def render_to_string(template_name, dictionary=None, context_instance=None, encoding=None): 91 91 """ 92 92 Loads the given template_name and renders it with the given dictionary as … … 104 104 else: 105 105 context_instance = Context(dictionary) 106 return t.render(context_instance )106 return t.render(context_instance, encoding) 107 107 108 108 def select_template(template_name_list): django/branches/unicode/django/test/utils.py
r5185 r5277 11 11 TEST_DATABASE_PREFIX = 'test_' 12 12 13 def instrumented_test_render(self, context): 14 """An instrumented Template render method, providing a signal 13 def instrumented_test_render(self, context, unused=None): 14 """ 15 An instrumented Template render method, providing a signal 15 16 that can be intercepted by the test system Client 16 17 17 """ 18 18 dispatcher.send(signal=signals.template_rendered, sender=self, template=self, context=context)
