Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-wiki
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-wiki
Commits
751c21ad
Commit
751c21ad
authored
Aug 09, 2012
by
benjaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better error if permissions are wrong on MEDIA_ROOT
parent
b6e7b94d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
wiki/plugins/attachments/views.py
+5
-0
No files found.
wiki/plugins/attachments/views.py
View file @
751c21ad
...
@@ -13,6 +13,7 @@ from django.views.generic.base import TemplateView, View
...
@@ -13,6 +13,7 @@ from django.views.generic.base import TemplateView, View
from
wiki.core.http
import
send_file
from
wiki.core.http
import
send_file
from
django.http
import
Http404
from
django.http
import
Http404
from
django.db
import
transaction
from
django.db
import
transaction
import
os
class
AttachmentView
(
ArticleMixin
,
FormView
):
class
AttachmentView
(
ArticleMixin
,
FormView
):
...
@@ -29,6 +30,7 @@ class AttachmentView(ArticleMixin, FormView):
...
@@ -29,6 +30,7 @@ class AttachmentView(ArticleMixin, FormView):
# Fixing some weird transaction issue caused by adding commit_manually to form_valid
# Fixing some weird transaction issue caused by adding commit_manually to form_valid
return
super
(
AttachmentView
,
self
)
.
dispatch
(
request
,
article
,
*
args
,
**
kwargs
)
return
super
(
AttachmentView
,
self
)
.
dispatch
(
request
,
article
,
*
args
,
**
kwargs
)
# WARNING! The below decorator silences other exceptions that may occur!
@transaction.commit_manually
@transaction.commit_manually
def
form_valid
(
self
,
form
):
def
form_valid
(
self
,
form
):
try
:
try
:
...
@@ -45,6 +47,9 @@ class AttachmentView(ArticleMixin, FormView):
...
@@ -45,6 +47,9 @@ class AttachmentView(ArticleMixin, FormView):
except
models
.
IllegalFileExtension
,
e
:
except
models
.
IllegalFileExtension
,
e
:
transaction
.
rollback
()
transaction
.
rollback
()
messages
.
error
(
self
.
request
,
_
(
u'Your file could not be saved:
%
s'
)
%
e
)
messages
.
error
(
self
.
request
,
_
(
u'Your file could not be saved:
%
s'
)
%
e
)
except
IOError
:
transaction
.
rollback
()
messages
.
error
(
self
.
request
,
_
(
u'Your file could not be saved, probably because of a permission error on the web server.'
))
transaction
.
commit
()
transaction
.
commit
()
if
self
.
urlpath
:
if
self
.
urlpath
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment