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
e08b54d1
Commit
e08b54d1
authored
Nov 17, 2013
by
benjaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in decorator causing double reverse lookups
parent
e4d904e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
wiki/decorators.py
+3
-3
No files found.
wiki/decorators.py
View file @
e08b54d1
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.http
import
HttpResponse
,
HttpResponseNotFound
,
\
from
django.http
import
HttpResponse
,
HttpResponseNotFound
,
\
HttpResponseForbidden
HttpResponseForbidden
,
HttpResponseRedirect
from
django.shortcuts
import
redirect
,
get_object_or_404
from
django.shortcuts
import
redirect
,
get_object_or_404
from
django.template.context
import
RequestContext
from
django.template.context
import
RequestContext
...
@@ -90,7 +90,7 @@ def get_article(func=None, can_read=True, can_write=False,
...
@@ -90,7 +90,7 @@ def get_article(func=None, can_read=True, can_write=False,
pathlist
=
filter
(
lambda
x
:
x
!=
""
,
path
.
split
(
"/"
),)
pathlist
=
filter
(
lambda
x
:
x
!=
""
,
path
.
split
(
"/"
),)
path
=
"/"
.
join
(
pathlist
[:
-
1
])
path
=
"/"
.
join
(
pathlist
[:
-
1
])
parent
=
models
.
URLPath
.
get_by_path
(
path
)
parent
=
models
.
URLPath
.
get_by_path
(
path
)
return
r
edirect
(
reverse
(
"wiki:create"
,
kwargs
=
{
'path'
:
parent
.
path
,})
+
"?slug=
%
s"
%
pathlist
[
-
1
])
return
HttpResponseR
edirect
(
reverse
(
"wiki:create"
,
kwargs
=
{
'path'
:
parent
.
path
,})
+
"?slug=
%
s"
%
pathlist
[
-
1
])
except
models
.
URLPath
.
DoesNotExist
:
except
models
.
URLPath
.
DoesNotExist
:
c
=
RequestContext
(
request
,
{
'error_type'
:
'ancestors_missing'
})
c
=
RequestContext
(
request
,
{
'error_type'
:
'ancestors_missing'
})
return
HttpResponseNotFound
(
render_to_string
(
"wiki/error.html"
,
context_instance
=
c
))
return
HttpResponseNotFound
(
render_to_string
(
"wiki/error.html"
,
context_instance
=
c
))
...
@@ -101,7 +101,7 @@ def get_article(func=None, can_read=True, can_write=False,
...
@@ -101,7 +101,7 @@ def get_article(func=None, can_read=True, can_write=False,
# Be robust: Somehow article is gone but urlpath exists... clean up
# Be robust: Somehow article is gone but urlpath exists... clean up
return_url
=
reverse
(
'wiki:get'
,
kwargs
=
{
'path'
:
urlpath
.
parent
.
path
})
return_url
=
reverse
(
'wiki:get'
,
kwargs
=
{
'path'
:
urlpath
.
parent
.
path
})
urlpath
.
delete
()
urlpath
.
delete
()
return
r
edirect
(
return_url
)
return
HttpResponseR
edirect
(
return_url
)
# fetch by article.id
# fetch by article.id
...
...
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