# HG changeset patch # User Todd Larsen # Date 1235075447 0 # Node ID 5b154edd94ac9aa20b31bb4b3c6d7f9cc5ee5e4b # Parent e6a11f0dba683d43c211f1b6fba91408de19fa7f Make it easier to support other extensions per-Model (such as .csv, etc.). Patch by: Todd Larsen Review by: to-be-reviewed diff -r e6a11f0dba68 -r 5b154edd94ac app/soc/views/models/base.py --- a/app/soc/views/models/base.py Thu Feb 19 20:24:17 2009 +0000 +++ b/app/soc/views/models/base.py Thu Feb 19 20:30:47 2009 +0000 @@ -61,6 +61,8 @@ DEF_CREATE_INSTRUCTION_MSG_FMT = ugettext( 'Please select a %s for the new %s.') + DEF_EXPORT_EXTENSION = '.txt' + def __init__(self, params=None): """ @@ -223,8 +225,12 @@ template = params['export_template'] response_args = {'mimetype': params['export_content_type']} + + export_extension = params.get('export_extension', + self.DEF_EXPORT_EXTENSION) response_headers = { - 'Content-Disposition': 'attachment; filename=%s.txt' % entity.link_id, + 'Content-Disposition': 'attachment; filename=%s%s' % ( + entity.link_id, export_extension), } return helper.responses.respond(request, template, context=context, diff -r e6a11f0dba68 -r 5b154edd94ac app/soc/views/models/document.py --- a/app/soc/views/models/document.py Thu Feb 19 20:24:17 2009 +0000 +++ b/app/soc/views/models/document.py Thu Feb 19 20:30:47 2009 +0000 @@ -75,6 +75,7 @@ new_params['name'] = "Document" new_params['export_content_type'] = 'text/text' + new_params['export_extension'] = '.html' new_params['no_create_raw'] = True new_params['no_create_with_scope'] = True