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
7f6acb73
Commit
7f6acb73
authored
Feb 23, 2013
by
benjaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#119 do not fail when deleting blank image and attachment fields
parent
51497ca2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
6 deletions
+11
-6
wiki/plugins/attachments/models.py
+6
-2
wiki/plugins/images/models.py
+2
-0
wiki/templates/wiki/base.html
+2
-2
wiki/views/accounts.py
+1
-2
No files found.
wiki/plugins/attachments/models.py
View file @
7f6acb73
...
@@ -166,7 +166,11 @@ def on_revision_delete(instance, *args, **kwargs):
...
@@ -166,7 +166,11 @@ def on_revision_delete(instance, *args, **kwargs):
max_depth
=
1
max_depth
=
1
for
depth
in
range
(
0
,
max_depth
):
for
depth
in
range
(
0
,
max_depth
):
delete_path
=
"/"
.
join
(
path
[:
-
depth
]
if
depth
>
0
else
path
)
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
:
os
.
rmdir
(
delete_path
)
if
len
(
os
.
listdir
(
os
.
path
.
join
(
django_settings
.
MEDIA_ROOT
,
delete_path
)))
==
0
:
os
.
rmdir
(
delete_path
)
except
OSError
:
# Raised by os.listdir if directory is missing
pass
signals
.
pre_delete
.
connect
(
on_revision_delete
,
AttachmentRevision
)
signals
.
pre_delete
.
connect
(
on_revision_delete
,
AttachmentRevision
)
wiki/plugins/images/models.py
View file @
7f6acb73
...
@@ -103,6 +103,8 @@ class ImageRevision(RevisionPluginRevision):
...
@@ -103,6 +103,8 @@ class ImageRevision(RevisionPluginRevision):
def
on_image_revision_delete
(
instance
,
*
args
,
**
kwargs
):
def
on_image_revision_delete
(
instance
,
*
args
,
**
kwargs
):
if
not
instance
.
image
:
return
# Remove image file
# Remove image file
path
=
instance
.
image
.
path
.
split
(
"/"
)[:
-
1
]
path
=
instance
.
image
.
path
.
split
(
"/"
)[:
-
1
]
instance
.
image
.
delete
(
save
=
False
)
instance
.
image
.
delete
(
save
=
False
)
...
...
wiki/templates/wiki/base.html
View file @
7f6acb73
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<html
lang=
"en"
>
<html
lang=
"en"
>
<head>
<head>
<meta
charset=
"utf-8"
>
<meta
charset=
"utf-8"
>
<title>
{% block pagetitle %}{% endblock %} -
-
django-\/\/ i K |
</title>
<title>
{% block pagetitle %}{% endblock %} - django-\/\/ i K |
</title>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"description"
content=
""
>
<meta
name=
"description"
content=
""
>
<meta
name=
"author"
content=
"www.django-wiki.org"
>
<meta
name=
"author"
content=
"www.django-wiki.org"
>
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
</a>
</a>
{% block wiki_header_branding %}
{% block wiki_header_branding %}
<a
class=
"brand"
href=
"{% url 'wiki:root' %}"
>
django-
wiki
</a>
<a
class=
"brand"
href=
"{% url 'wiki:root' %}"
>
django-
\/\/ i K |
</a>
{% endblock %}
{% endblock %}
<form
class=
"navbar-search pull-right"
id=
"navbar_wiki_search"
method=
"GET"
action=
"{% url 'wiki:search' %}"
>
<form
class=
"navbar-search pull-right"
id=
"navbar_wiki_search"
method=
"GET"
action=
"{% url 'wiki:search' %}"
>
<span
class=
"icon-search"
></span>
<span
class=
"icon-search"
></span>
...
...
wiki/views/accounts.py
View file @
7f6acb73
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""This is nothing but the usual handling of django user accounts, so
"""Here is a very basic handling of accounts."""
go ahead and replace it or disable it!"""
from
django.conf
import
settings
as
django_settings
from
django.conf
import
settings
as
django_settings
from
django.contrib
import
messages
from
django.contrib
import
messages
...
...
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