| author | gibus |
| Tue, 31 Jul 2012 16:37:23 +0200 | |
| changeset 453 | 1d314f629611 |
| parent 443 | cacd524f5279 |
| child 454 | b7a092a52eae |
| permissions | -rw-r--r-- |
| 0 | 1 |
from django import forms |
2 |
from django.core.urlresolvers import reverse |
|
3 |
from django.http import HttpResponse, HttpResponseRedirect, Http404 |
|
4 |
from django.shortcuts import render_to_response |
|
|
453
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
5 |
from django.template.loader import render_to_string |
| 0 | 6 |
from django.template import RequestContext |
7 |
from django.utils.translation import ugettext as _, ugettext_lazy |
|
|
453
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
8 |
from django.contrib.auth.models import User |
| 364 | 9 |
from cm.converters.pandoc_converters import pandoc_convert, do_tidy |
| 0 | 10 |
from cm.models import Text, TextVersion, Attachment, Comment |
|
453
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
11 |
from cm.security import get_viewable_comments |
| 0 | 12 |
import mimetypes |
13 |
import simplejson |
|
|
360
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
14 |
from cm.cm_settings import USE_ABI |
| 0 | 15 |
EXPORT2_INFOS = { |
16 |
# key -> { mimetype, extension} |
|
17 |
's5' : {}, |
|
18 |
'pdf' : {'mimetype': 'application/pdf', 'extension':'pdf'}, |
|
19 |
'markdown' : {'mimetype': 'text/plain', 'extension':'mkd'}, |
|
20 |
'odt' : {'mimetype': 'application/vnd.oasis.opendocument.text', 'extension':'odt'}, |
|
| 433 | 21 |
'doc' : {'mimetype': 'application/msword', 'extension':'doc'}, |
22 |
'docx' : {'mimetype': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'extension':'docx'}, |
|
| 0 | 23 |
'latex' :{'mimetype': 'text/x-tex', 'extension':'tex'}, |
24 |
'html' :{'mimetype': 'text/html', 'extension':'html'}, |
|
| 443 | 25 |
'epub' :{'mimetype': 'application/epub+zip', 'extension':'epub'}, |
|
453
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
26 |
'raw' : {'mimetype': 'text/plain', 'extension':'txt'}, |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
27 |
'xml' : {'mimetype': 'text/xml', 'extension':'xml'}, |
| 0 | 28 |
} |
29 |
def content_export2(request, content, title, content_format, format, use_pandoc, download_response): |
|
30 |
# TODO : formats must be imported from converters |
|
|
56
bd8a4ffc7dad
BUG FIX : pdf export PhA tests, TODO fix special html caracters in comments
reno
parents:
0
diff
changeset
|
31 |
# import pdb;pdb.set_trace() |
| 0 | 32 |
if format == 'raw' : |
33 |
export_content = content |
|
34 |
elif content_format == 'html' and format == 'html': |
|
35 |
export_content = HTML_HEADER % content |
|
36 |
elif content_format == 'markdown' and format == 'markdown': |
|
37 |
export_content = content |
|
38 |
else: |
|
39 |
if use_pandoc : |
|
|
367
e4a0c2fe8df2
markdown2pdf is buggy => convert to HTML and use abiword to export in PDF
gibus
parents:
364
diff
changeset
|
40 |
# markdown2pdf is buggy => convert to HTML and use abiword to export in PDF |
|
e4a0c2fe8df2
markdown2pdf is buggy => convert to HTML and use abiword to export in PDF
gibus
parents:
364
diff
changeset
|
41 |
if format == 'pdf' and USE_ABI: |
|
e4a0c2fe8df2
markdown2pdf is buggy => convert to HTML and use abiword to export in PDF
gibus
parents:
364
diff
changeset
|
42 |
html_content = pandoc_convert(content, content_format, 'html', full=True) |
|
e4a0c2fe8df2
markdown2pdf is buggy => convert to HTML and use abiword to export in PDF
gibus
parents:
364
diff
changeset
|
43 |
from cm.converters.abi_converters import AbiFileConverter |
|
e4a0c2fe8df2
markdown2pdf is buggy => convert to HTML and use abiword to export in PDF
gibus
parents:
364
diff
changeset
|
44 |
converter = AbiFileConverter() |
|
e4a0c2fe8df2
markdown2pdf is buggy => convert to HTML and use abiword to export in PDF
gibus
parents:
364
diff
changeset
|
45 |
full_content = converter.add_html_header(html_content) |
|
e4a0c2fe8df2
markdown2pdf is buggy => convert to HTML and use abiword to export in PDF
gibus
parents:
364
diff
changeset
|
46 |
fix_content = do_tidy(full_content) |
|
e4a0c2fe8df2
markdown2pdf is buggy => convert to HTML and use abiword to export in PDF
gibus
parents:
364
diff
changeset
|
47 |
export_content = converter.convert_from_html(fix_content, format) |
|
e4a0c2fe8df2
markdown2pdf is buggy => convert to HTML and use abiword to export in PDF
gibus
parents:
364
diff
changeset
|
48 |
else: |
| 0 | 49 |
export_content = pandoc_convert(content, content_format, format, full=True) |
50 |
else : |
|
51 |
fix_content = content |
|
52 |
if content_format == 'html': |
|
|
360
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
53 |
if USE_ABI: |
|
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
54 |
from cm.converters.abi_converters import AbiFileConverter |
|
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
55 |
converter = AbiFileConverter() |
| 364 | 56 |
full_content = converter.add_html_header(content) |
57 |
fix_content = do_tidy(full_content) |
|
|
360
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
58 |
else: |
|
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
59 |
from cm.converters.oo_converters import combine_css_body |
|
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
60 |
fix_content = combine_css_body(content, '') |
|
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
61 |
if USE_ABI: |
|
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
62 |
from cm.converters.abi_converters import AbiFileConverter |
|
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
63 |
converter = AbiFileConverter() |
|
441
d5d3bcd26a0b
Fixes export with abiword when attached images are served by co-ment
gibus
parents:
433
diff
changeset
|
64 |
|
|
d5d3bcd26a0b
Fixes export with abiword when attached images are served by co-ment
gibus
parents:
433
diff
changeset
|
65 |
# replaces images url by their actual path |
|
d5d3bcd26a0b
Fixes export with abiword when attached images are served by co-ment
gibus
parents:
433
diff
changeset
|
66 |
from django.conf import settings |
|
d5d3bcd26a0b
Fixes export with abiword when attached images are served by co-ment
gibus
parents:
433
diff
changeset
|
67 |
site_url = settings.SITE_URL |
|
d5d3bcd26a0b
Fixes export with abiword when attached images are served by co-ment
gibus
parents:
433
diff
changeset
|
68 |
import re |
|
d5d3bcd26a0b
Fixes export with abiword when attached images are served by co-ment
gibus
parents:
433
diff
changeset
|
69 |
attach_re = r'/attach/(?P<attach_key>\w*)/' |
|
d5d3bcd26a0b
Fixes export with abiword when attached images are served by co-ment
gibus
parents:
433
diff
changeset
|
70 |
attach_str = r'%s/attach/%s/' |
|
d5d3bcd26a0b
Fixes export with abiword when attached images are served by co-ment
gibus
parents:
433
diff
changeset
|
71 |
for match in re.findall(attach_re, fix_content): |
|
d5d3bcd26a0b
Fixes export with abiword when attached images are served by co-ment
gibus
parents:
433
diff
changeset
|
72 |
link = attach_str %(site_url, match) |
|
d5d3bcd26a0b
Fixes export with abiword when attached images are served by co-ment
gibus
parents:
433
diff
changeset
|
73 |
attach = Attachment.objects.get(key=match) |
|
d5d3bcd26a0b
Fixes export with abiword when attached images are served by co-ment
gibus
parents:
433
diff
changeset
|
74 |
fix_content = fix_content.replace(link, attach.data.path) |
|
d5d3bcd26a0b
Fixes export with abiword when attached images are served by co-ment
gibus
parents:
433
diff
changeset
|
75 |
|
|
360
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
76 |
export_content = converter.convert_from_html(fix_content, format) |
|
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
77 |
else: |
|
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
78 |
from cm.converters.oo_converters import convert_html as oo_convert |
|
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
79 |
export_content = oo_convert(fix_content, format) |
| 0 | 80 |
|
81 |
export_infos = EXPORT2_INFOS[format] |
|
82 |
||
83 |
if download_response: |
|
84 |
return _response_download(export_content, title, export_infos['mimetype'], export_infos['extension']) ; |
|
85 |
else: |
|
86 |
return _response_write(export_content) |
|
87 |
||
88 |
def content_export_new(request, content, title, src_format, format, use_pandoc, download_response): |
|
89 |
# TODO : formats must be imported from converters |
|
90 |
if format == 'raw' : |
|
91 |
export_content = content |
|
92 |
elif src_format == format and format == 'html': |
|
93 |
export_content = HTML_HEADER % content |
|
94 |
else: |
|
95 |
if use_pandoc : |
|
96 |
export_content = pandoc_convert(content, src_format, format, full=True) |
|
97 |
else : |
|
98 |
fix_content = content |
|
99 |
if src_format == 'html': |
|
|
77
fe91eb717a96
import oo_converters locally (not at module level) to avoid weird uno imports
raph
parents:
57
diff
changeset
|
100 |
from cm.converters.oo_converters import combine_css_body |
| 0 | 101 |
fix_content = combine_css_body(content, '') |
|
77
fe91eb717a96
import oo_converters locally (not at module level) to avoid weird uno imports
raph
parents:
57
diff
changeset
|
102 |
from cm.converters.oo_converters import convert_html as oo_convert |
| 0 | 103 |
export_content = oo_convert(fix_content, format) |
104 |
||
105 |
export_infos = EXPORT_INFOS[format] |
|
106 |
format_download = export_infos[0] |
|
107 |
||
108 |
if download_response: |
|
109 |
return _response_download(export_content, export_infos[1], export_infos[2]) ; |
|
110 |
else: |
|
111 |
return _response_write(export_content) |
|
112 |
||
113 |
||
114 |
# read conversion chain |
|
115 |
# execute chain |
|
116 |
# ready to send response |
|
117 |
# # TODO : formats must be imported from converters |
|
118 |
# if format == 'raw' : |
|
119 |
# export_content = content |
|
120 |
# elif src_format == format and format == 'html': |
|
121 |
# export_content = HTML_HEADER % content |
|
122 |
# else: |
|
123 |
# if use_pandoc : |
|
124 |
# export_content = pandoc_convert(content, src_format, format, full=True) |
|
125 |
# else : |
|
126 |
# fix_content = content |
|
127 |
# if src_format == 'html': |
|
128 |
# fix_content = combine_css_body(content, '') |
|
129 |
# export_content = oo_convert(fix_content, format) |
|
130 |
# |
|
131 |
## send response |
|
132 |
# export_infos = EXPORT_INFOS[format] |
|
133 |
# mimetype = export_infos['mimetype'] |
|
134 |
# extension = export_infos['extension'] |
|
135 |
# |
|
136 |
# if download: |
|
137 |
# return _response_download(export_content, mimetype, extension) |
|
138 |
# else : |
|
139 |
# return _response_write(export_content) |
|
140 |
# |
|
141 |
def _response_download(content, title, mimetype, extension): |
|
142 |
response = HttpResponse(mimetype=mimetype) |
|
143 |
file_title = title + '.' + extension |
|
144 |
from email.header import Header |
|
145 |
encoded_name = str(Header(file_title.encode('utf8'), charset='utf8', maxlinelen=500)) |
|
|
52
9fa013909d9a
prevent header error if newline in header (pb not fully solved)
raph
parents:
0
diff
changeset
|
146 |
# TODO: find a way to include long (more than 76 chars) into header |
|
9fa013909d9a
prevent header error if newline in header (pb not fully solved)
raph
parents:
0
diff
changeset
|
147 |
encoded_name = encoded_name.replace('\n','') |
|
9fa013909d9a
prevent header error if newline in header (pb not fully solved)
raph
parents:
0
diff
changeset
|
148 |
response['Content-Disposition'] = 'attachment; filename=%s' % encoded_name |
| 0 | 149 |
response.write(content) |
150 |
return response |
|
151 |
||
152 |
def _response_write(content): |
|
153 |
response = HttpResponse() |
|
154 |
response.write(content) |
|
155 |
return response |
|
156 |
||
157 |
||
158 |
EXPORT_INFOS = { |
|
159 |
# key -> [ download?, mimetype, extension] |
|
160 |
's5' : [False , ], |
|
161 |
'pdf' : [True , 'application/pdf' , 'pdf'], |
|
162 |
'markdown' : [True , 'text/plain' , 'mkd'], |
|
163 |
'odt' : [True , 'application/vnd.oasis.opendocument.text', 'odt'], |
|
| 433 | 164 |
'doc' : [True , 'application/msword', 'odt'], |
165 |
'docx' : [True , 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'docx'], |
|
| 0 | 166 |
'latex' :[True , 'text/x-tex', 'tex'], |
167 |
'html' :[True , 'text/html', 'html'], |
|
| 443 | 168 |
'epub' :[True , 'application/epub+zip', 'epub'], |
| 0 | 169 |
# raw export |
170 |
'raw' : [True, 'text/plain', 'txt'] |
|
171 |
} |
|
172 |
HTML_HEADER = u""" |
|
173 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
|
174 |
<html><head> |
|
175 |
<STYLE TYPE='text/css'> |
|
176 |
div.pagebreakhere { |
|
177 |
page-break-before: always ; |
|
178 |
} |
|
179 |
</STYLE> |
|
180 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/></head> |
|
181 |
<body>%s</body> |
|
182 |
</html> |
|
183 |
""" |
|
184 |
EXPORT_FORMATS = EXPORT_INFOS.keys() |
|
185 |
||
186 |
def content_export(request, content, title, src_format, format, use_pandoc): |
|
187 |
# TODO : formats must be imported from converters |
|
188 |
if format == 'raw' : |
|
189 |
export_content = content |
|
190 |
elif src_format == format and format == 'html': |
|
191 |
export_content = HTML_HEADER % content |
|
192 |
else: |
|
193 |
if use_pandoc : |
|
194 |
export_content = pandoc_convert(content, src_format, format, full=True) |
|
195 |
else : |
|
196 |
fix_content = content |
|
197 |
if src_format == 'html': |
|
|
77
fe91eb717a96
import oo_converters locally (not at module level) to avoid weird uno imports
raph
parents:
57
diff
changeset
|
198 |
from cm.converters.oo_converters import combine_css_body |
| 0 | 199 |
fix_content = combine_css_body(content, '') |
|
77
fe91eb717a96
import oo_converters locally (not at module level) to avoid weird uno imports
raph
parents:
57
diff
changeset
|
200 |
from cm.converters.oo_converters import convert_html as oo_convert |
| 0 | 201 |
export_content = oo_convert(fix_content, format) |
202 |
||
203 |
export_infos = EXPORT_INFOS[format] |
|
204 |
format_download = export_infos[0] |
|
205 |
||
206 |
if format_download: |
|
207 |
format_mimetype = export_infos[1] |
|
208 |
format_extension = export_infos[2] |
|
209 |
||
210 |
response = HttpResponse(mimetype=format_mimetype) |
|
211 |
file_title = title + '.' + format_extension |
|
212 |
from email.header import Header |
|
213 |
encoded_name = str(Header(file_title.encode('utf8'), charset='utf8', maxlinelen=500)) |
|
214 |
response['Content-Disposition'] = u'attachment; filename=%s' % encoded_name |
|
215 |
response.write(export_content) |
|
216 |
return response |
|
217 |
else: |
|
218 |
response = HttpResponse() |
|
219 |
response.write(export_content) |
|
220 |
return response |
|
221 |
||
222 |
||
223 |
def text_export(request, key, format): |
|
224 |
# TODO : formats must be imported from converters |
|
225 |
format = format.lower() |
|
226 |
if format not in EXPORT_FORMATS: |
|
227 |
raise Exception("Unsupported format %s (supported formats %s)" % (format, ' '.join(EXPORT_FORMATS))) |
|
228 |
text = Text.objects.get(key=key) |
|
229 |
text_version = text.get_latest_version() |
|
230 |
||
231 |
return content_export(request, text_version.content, text_version.title, text_version.format, format) |
|
232 |
||
233 |
def text_feed(request, key): |
|
|
360
bfaab8740995
Add abiword as an alternative to open office for conversions
gibus
parents:
77
diff
changeset
|
234 |
return "" |
|
453
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
235 |
|
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
236 |
def xml_export(request, text_version, whichcomments): |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
237 |
# Text version infos |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
238 |
template_dict = { 'title': text_version.title, 'date': text_version.modified, 'format': text_version.format, 'content': text_version.get_content(), 'tags': text_version.tags, } |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
239 |
|
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
240 |
# Comments |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
241 |
comments = [] # whichcomments=="none" |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
242 |
if whichcomments == "filtered" or whichcomments == "all": |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
243 |
_comments = text_version.comment_set.all() |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
244 |
if whichcomments == "filtered" : |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
245 |
filteredIds = [] |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
246 |
if request.method == 'POST' : |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
247 |
ll = request.POST.get('filteredIds',[]).split(",") |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
248 |
filteredIds = [ int(l) for l in ll if l] |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
249 |
_comments = text_version.comment_set.filter(id__in=filteredIds) |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
250 |
comments = get_viewable_comments(request, _comments, text_version, order_by=('start_wrapper','start_offset','end_wrapper','end_offset')) |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
251 |
# Add user name/email if missing comment name/email |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
252 |
for comment in comments: |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
253 |
users = User.objects.filter(id=comment.user_id) |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
254 |
if not(comment.name): |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
255 |
comment.name = users[0].username |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
256 |
if not(comment.email): |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
257 |
comment.email = users[0].email |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
258 |
|
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
259 |
template_dict['comments'] = comments |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
260 |
|
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
261 |
# Author |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
262 |
users = User.objects.filter(id=text_version.user_id) |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
263 |
if text_version.name: |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
264 |
template_dict['name'] = text_version.name |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
265 |
else: |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
266 |
template_dict['name'] = users[0].username |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
267 |
if text_version.email: |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
268 |
template_dict['email'] = text_version.email |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
269 |
else: |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
270 |
template_dict['email'] = users[0].email |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
271 |
|
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
272 |
# Renders template |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
273 |
export_content = render_to_string('site/export.xml', template_dict, context_instance=RequestContext(request)) |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
274 |
|
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
275 |
# Returns HTTP response |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
276 |
export_infos = EXPORT2_INFOS['xml'] |
|
1d314f629611
Added export to XML for re-import (nb. without attachements).
gibus
parents:
443
diff
changeset
|
277 |
return _response_download(export_content, text_version.title, export_infos['mimetype'], export_infos['extension']) ; |