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
9c83dfb5
Commit
9c83dfb5
authored
Aug 16, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issues where 'if user.is_anonymous' was missing () so was always True
parent
484ff1ce
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
wiki/decorators.py
+2
-2
wiki/plugins/attachments/views.py
+2
-2
wiki/views/article.py
+1
-1
No files found.
wiki/decorators.py
View file @
9c83dfb5
...
@@ -78,14 +78,14 @@ def get_article(func=None, can_read=True, can_write=False, deleted_contents=Fals
...
@@ -78,14 +78,14 @@ def get_article(func=None, can_read=True, can_write=False, deleted_contents=Fals
return
redirect
(
return_url
)
return
redirect
(
return_url
)
if
can_read
and
not
article
.
can_read
(
request
.
user
):
if
can_read
and
not
article
.
can_read
(
request
.
user
):
if
request
.
user
.
is_anonymous
:
if
request
.
user
.
is_anonymous
()
:
return
redirect
(
django_settings
.
LOGIN_URL
)
return
redirect
(
django_settings
.
LOGIN_URL
)
else
:
else
:
pass
pass
# TODO: Return a permission denied page
# TODO: Return a permission denied page
if
can_write
and
not
article
.
can_write
(
request
.
user
):
if
can_write
and
not
article
.
can_write
(
request
.
user
):
if
request
.
user
.
is_anonymous
:
if
request
.
user
.
is_anonymous
()
:
return
redirect
(
django_settings
.
LOGIN_URL
)
return
redirect
(
django_settings
.
LOGIN_URL
)
else
:
else
:
pass
pass
...
...
wiki/plugins/attachments/views.py
View file @
9c83dfb5
...
@@ -35,7 +35,7 @@ class AttachmentView(ArticleMixin, FormView):
...
@@ -35,7 +35,7 @@ class AttachmentView(ArticleMixin, FormView):
# WARNING! The below decorator silences other exceptions that may occur!
# WARNING! The below decorator silences other exceptions that may occur!
#@transaction.commit_manually
#@transaction.commit_manually
def
form_valid
(
self
,
form
):
def
form_valid
(
self
,
form
):
if
self
.
request
.
user
.
is_anonymous
and
not
settings
.
ANONYMOUS
:
if
self
.
request
.
user
.
is_anonymous
()
and
not
settings
.
ANONYMOUS
:
return
redirect
(
django_settings
.
LOGIN_URL
)
return
redirect
(
django_settings
.
LOGIN_URL
)
try
:
try
:
...
@@ -63,7 +63,7 @@ class AttachmentView(ArticleMixin, FormView):
...
@@ -63,7 +63,7 @@ class AttachmentView(ArticleMixin, FormView):
kwargs
[
'attachments'
]
=
self
.
attachments
kwargs
[
'attachments'
]
=
self
.
attachments
kwargs
[
'search_form'
]
=
forms
.
SearchForm
()
kwargs
[
'search_form'
]
=
forms
.
SearchForm
()
kwargs
[
'selected_tab'
]
=
'attachments'
kwargs
[
'selected_tab'
]
=
'attachments'
kwargs
[
'anonymous_disallowed'
]
=
self
.
request
.
user
.
is_anonymous
and
not
settings
.
ANONYMOUS
kwargs
[
'anonymous_disallowed'
]
=
self
.
request
.
user
.
is_anonymous
()
and
not
settings
.
ANONYMOUS
return
super
(
AttachmentView
,
self
)
.
get_context_data
(
**
kwargs
)
return
super
(
AttachmentView
,
self
)
.
get_context_data
(
**
kwargs
)
...
...
wiki/views/article.py
View file @
9c83dfb5
...
@@ -59,7 +59,7 @@ class Create(FormView, ArticleMixin):
...
@@ -59,7 +59,7 @@ class Create(FormView, ArticleMixin):
def
form_valid
(
self
,
form
):
def
form_valid
(
self
,
form
):
user
=
None
user
=
None
ip_address
=
None
ip_address
=
None
if
not
self
.
request
.
user
.
is_anonymous
:
if
not
self
.
request
.
user
.
is_anonymous
()
:
user
=
self
.
request
.
user
user
=
self
.
request
.
user
if
settings
.
LOG_IPS_USERS
:
if
settings
.
LOG_IPS_USERS
:
ip_address
=
self
.
request
.
META
.
get
(
'REMOTE_ADDR'
,
None
)
ip_address
=
self
.
request
.
META
.
get
(
'REMOTE_ADDR'
,
None
)
...
...
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