Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
eeec1461
Commit
eeec1461
authored
Jan 10, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Plain Diff
Merged with simplewiki search changes
parents
bc3a6d38
678c9464
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
simplewiki/views.py
+13
-6
No files found.
simplewiki/views.py
View file @
eeec1461
...
...
@@ -31,7 +31,7 @@ def view(request, wiki_url):
(
article
,
path
,
err
)
=
fetch_from_url
(
request
,
wiki_url
)
if
err
:
return
err
perm_err
=
check_permissions
(
request
,
article
,
check_read
=
True
)
if
perm_err
:
return
perm_err
...
...
@@ -39,7 +39,7 @@ def view(request, wiki_url):
'wiki_write'
:
article
.
can_write_l
(
request
.
user
),
'wiki_attachments_write'
:
article
.
can_attach
(
request
.
user
),
}
d
.
update
(
csrf
(
request
))
return
render_to_response
(
'simplewiki_view.html'
,
d
)
def
root_redirect
(
request
):
...
...
@@ -74,6 +74,7 @@ def create(request, wiki_url):
if
url_path
!=
[]
and
url_path
[
0
]
.
startswith
(
'_'
):
d
=
{
'wiki_err_keyword'
:
True
,
'wiki_url'
:
'/'
.
join
(
url_path
)
}
d
.
update
(
csrf
(
request
))
return
render_to_response
(
'simplewiki_error.html'
,
d
)
# Lookup path
...
...
@@ -88,6 +89,7 @@ def create(request, wiki_url):
if
not
path
:
d
=
{
'wiki_err_noparent'
:
True
,
'wiki_url_parent'
:
'/'
.
join
(
url_path
[:
-
1
])
}
d
.
update
(
csrf
(
request
))
return
render_to_response
(
'simplewiki_error.html'
,
d
)
perm_err
=
check_permissions
(
request
,
path
[
-
1
],
check_locked
=
False
,
check_write
=
True
)
...
...
@@ -266,6 +268,7 @@ def search_articles(request, wiki_url):
else
:
d
=
{
'wiki_search_results'
:
results
,
'wiki_search_query'
:
querystring
}
d
.
update
(
csrf
(
request
))
return
render_to_response
(
'simplewiki_searchresults.html'
,
d
)
return
view
(
request
,
wiki_url
)
...
...
@@ -356,15 +359,18 @@ def random_article(request, wiki_url):
return
HttpResponseRedirect
(
reverse
(
'wiki_view'
,
args
=
(
article
.
get_url
(),)))
def
encode_err
(
request
,
url
):
return
render_to_response
(
'simplewiki_error.html'
,
{
'wiki_err_encode'
:
True
})
d
=
{
'wiki_err_encode'
:
True
}
d
.
update
(
csrf
(
request
))
return
render_to_response
(
'simplewiki_error.html'
,
d
)
def
not_found
(
request
,
wiki_url
):
if
not
request
.
user
.
is_authenticated
():
return
redirect
(
'/'
)
"""Generate a NOT FOUND message for some URL"""
return
render_to_response
(
'simplewiki_error.html'
,
{
'wiki_err_notfound'
:
True
,
'wiki_url'
:
wiki_url
})
d
=
{
'wiki_err_notfound'
:
True
,
'wiki_url'
:
wiki_url
}
d
.
update
(
csrf
(
request
))
return
render_to_response
(
'simplewiki_error.html'
,
d
)
def
get_url_path
(
url
):
"""Return a list of all actual elements of a url, safely ignoring
...
...
@@ -408,6 +414,7 @@ def check_permissions(request, article, check_read=False, check_write=False, che
'wiki_err_noread'
:
read_err
,
'wiki_err_nowrite'
:
write_err
,
'wiki_err_locked'
:
locked_err
,}
d
.
update
(
csrf
(
request
))
# TODO: Make this a little less jarring by just displaying an error
# on the current page? (no such redirect happens for an anon upload yet)
# benjaoming: I think this is the nicest way of displaying an error, but
...
...
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