0001-manager-remove-broken-export-to-HTML-21197.patch
src/authentic2/manager/views.py | ||
---|---|---|
188 | 188 |
class FormatsContextData(object): |
189 | 189 |
'''Export list of supported formats in context''' |
190 | 190 | |
191 |
formats = ['csv', 'json', 'ods', 'html']
|
|
191 |
formats = ['csv', 'json', 'ods'] |
|
192 | 192 | |
193 | 193 |
def get_context_data(self, **kwargs): |
194 | 194 |
ctx = super(FormatsContextData, self).get_context_data(**kwargs) |
... | ... | |
342 | 342 |
export_format = kwargs['format'].lower() |
343 | 343 |
content_types = { |
344 | 344 |
'csv': 'text/csv', |
345 |
'html': 'text/html', |
|
346 | 345 |
'json': 'application/json', |
347 | 346 |
'ods': 'application/vnd.oasis.opendocument.spreadsheet', |
348 | 347 |
} |
... | ... | |
350 | 349 |
raise Http404('unknown format') |
351 | 350 |
content = getattr(self.get_dataset(), export_format) |
352 | 351 |
content_type = content_types[export_format] |
353 |
if export_format == 'html': |
|
354 |
content = '<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body>%s</body></html>' % content |
|
355 | 352 |
response = HttpResponse(content, content_type=content_type) |
356 | 353 |
filename = '%s%s.%s' % (self.get_export_prefix(), now().isoformat(), |
357 | 354 |
export_format) |
358 |
- |