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
2c39d152
Commit
2c39d152
authored
Feb 07, 2013
by
benjaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not fail when removing images located in non-existing dirs
parent
628b59c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletions
+6
-1
wiki/plugins/images/models.py
+6
-1
No files found.
wiki/plugins/images/models.py
View file @
2c39d152
...
...
@@ -118,7 +118,12 @@ def on_image_revision_delete(instance, *args, **kwargs):
max_depth
=
1
for
depth
in
range
(
0
,
max_depth
):
delete_path
=
"/"
.
join
(
path
[:
-
depth
]
if
depth
>
0
else
path
)
if
len
(
os
.
listdir
(
os
.
path
.
join
(
django_settings
.
MEDIA_ROOT
,
delete_path
)))
==
0
:
try
:
dir_list
=
os
.
listdir
(
os
.
path
.
join
(
django_settings
.
MEDIA_ROOT
,
delete_path
))
except
OSError
:
# Path does not exist, so let's not try to remove it...
dir_list
=
None
if
not
(
dir_list
is
None
)
and
len
(
dir_list
)
==
0
:
os
.
rmdir
(
delete_path
)
signals
.
pre_delete
.
connect
(
on_image_revision_delete
,
ImageRevision
)
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