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
b6e7b94d
Commit
b6e7b94d
authored
Aug 09, 2012
by
benjaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hopefully fixing transaction issue for other systems
parent
0c57d76f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
wiki/plugins/attachments/views.py
+3
-3
No files found.
wiki/plugins/attachments/views.py
View file @
b6e7b94d
...
...
@@ -25,11 +25,12 @@ class AttachmentView(ArticleMixin, FormView):
self
.
attachments
=
models
.
Attachment
.
objects
.
filter
(
articles
=
article
)
.
order_by
(
'current_revision__deleted'
,
'original_filename'
)
else
:
self
.
attachments
=
models
.
Attachment
.
active_objects
.
filter
(
articles
=
article
)
# Fixing some weird transaction issue caused by adding commit_manually to form_valid
return
super
(
AttachmentView
,
self
)
.
dispatch
(
request
,
article
,
*
args
,
**
kwargs
)
@transaction.commit_manually
def
form_valid
(
self
,
form
):
try
:
attachment_revision
=
form
.
save
(
commit
=
False
)
attachment
=
models
.
Attachment
()
...
...
@@ -41,12 +42,11 @@ class AttachmentView(ArticleMixin, FormView):
attachment_revision
.
set_from_request
(
self
.
request
)
attachment_revision
.
save
()
messages
.
success
(
self
.
request
,
_
(
u'
%
s was successfully added.'
)
%
attachment_revision
.
get_filename
())
transaction
.
commit
()
except
models
.
IllegalFileExtension
,
e
:
transaction
.
rollback
()
messages
.
error
(
self
.
request
,
_
(
u'Your file could not be saved:
%
s'
)
%
e
)
transaction
.
commit
()
transaction
.
commit
()
if
self
.
urlpath
:
return
redirect
(
"wiki:attachments_index"
,
self
.
urlpath
.
path
)
# TODO: What if no 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