(self, context, **response_kwargs)
| 212 | } |
| 213 | |
| 214 | def render_to_response(self, context, **response_kwargs): |
| 215 | def indent(s): |
| 216 | return s.replace("\n", "\n ") |
| 217 | |
| 218 | with builtin_template_path("i18n_catalog.js").open(encoding="utf-8") as fh: |
| 219 | template = Engine().from_string(fh.read()) |
| 220 | context["catalog_str"] = ( |
| 221 | indent(json.dumps(context["catalog"], sort_keys=True, indent=2)) |
| 222 | if context["catalog"] |
| 223 | else None |
| 224 | ) |
| 225 | context["formats_str"] = indent( |
| 226 | json.dumps(context["formats"], sort_keys=True, indent=2) |
| 227 | ) |
| 228 | |
| 229 | return HttpResponse( |
| 230 | template.render(Context(context)), 'text/javascript; charset="utf-8"' |
| 231 | ) |
| 232 | |
| 233 | |
| 234 | class JSONCatalog(JavaScriptCatalog): |
no test coverage detected