Changeset 181:c66e64ccb02f
- Timestamp:
- Nov 20, 2009 4:25:14 PM (4 years ago)
- Branch:
- default
- Location:
- djangobb/apps/forum
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
djangobb/apps/forum/forms.py
r177 r181 81 81 82 82 83 def save(self , commit=True):83 def save(self): 84 84 if self.forum: 85 85 topic = Topic(forum=self.forum, … … 93 93 markup='bbcode', 94 94 body=self.cleaned_data['body']) 95 95 96 post.save() 96 97 if forum_settings.ATTACHMENT_SUPPORT: 97 98 self.save_attachment(post, self.cleaned_data['attachment']) 98 99 if commit:100 post.save()101 99 return post 100 102 101 103 102 def save_attachment(self, post, memfile): -
djangobb/apps/forum/views.py
r177 r181 13 13 from django.utils import translation 14 14 from django.db.models import Q, F, Sum 15 15 from django.utils.encoding import smart_str 16 16 17 17 from forum.util import render_to, paged, build_form, paginate, set_language … … 791 791 def show_attachment(request, hash): 792 792 attachment = get_object_or_404(Attachment, hash=hash) 793 file_ obj = file(attachment.get_absolute_path())794 response = HttpResponse(file_ obj, content_type=attachment.content_type)795 response['Content-Disposition'] = 'attachment; filename=%s' % attachment.name.encode('utf-8', 'ignore')793 file_data = file(attachment.get_absolute_path()).read() 794 response = HttpResponse(file_data, mimetype=attachment.content_type) 795 response['Content-Disposition'] = 'attachment; filename=%s' % smart_str(attachment.name) 796 796 return response 797 797
Note: See TracChangeset
for help on using the changeset viewer.
