Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
924da963
Commit
924da963
authored
Aug 13, 2012
by
Baptiste Mouterde
Committed by
ikoalaz
Aug 13, 2012
Browse files
comment: fix score function, add no-js form
parent
be5f6485
Changes
1
Hide whitespace changes
Inline
Side-by-side
debexpo/controllers/comments.py
View file @
924da963
...
...
@@ -63,7 +63,6 @@ class CommentsController(BaseController):
args
[
'parent'
]
=
int
(
request
.
params
[
'parent'
])
else
:
args
[
'parent'
]
=
''
print
request
.
params
for
i
in
request
.
params
:
label
=
i
value
=
request
.
params
[
label
]
...
...
@@ -219,10 +218,13 @@ class CommentsController(BaseController):
this handle the up on a comment, it will add +1 to the comment stamina
"""
log
.
debug
(
'called by ajax with %s'
%
request
.
params
)
msg
=
MsgServiceController
()
return
self
.
score
(
request
.
params
[
'id'
],
request
.
params
[
'value'
])
return
self
.
_score
(
request
.
params
[
'id'
],
request
.
params
[
'value'
])
def
score
(
self
):
log
.
debug
(
'called by post with %s'
%
request
.
params
)
return
self
.
_score
(
request
.
params
[
'id'
],
request
.
params
[
'value'
])
def
score
(
self
,
comment_id
,
good
):
def
_
score
(
self
,
comment_id
,
good
):
"""
this handle the up on a comment, it will add +1 to the comment stamina
''comment_id''
...
...
@@ -231,6 +233,13 @@ class CommentsController(BaseController):
boolean, if true, 1 is added, if false, 1 is removed
"""
msg
=
MsgServiceController
()
if
not
(
str
(
good
)
==
'True'
or
str
(
good
)
==
'False'
or
str
(
good
)
==
'true'
or
str
(
good
)
==
'false'
):
log
.
debug
(
'bad data received : %s'
%
good
)
return
msg
.
call_msg
(
'failure'
,
'bad type received, send bool'
)
if
str
(
good
)
==
'true'
or
str
(
good
)
==
'True'
:
good
=
True
elif
str
(
good
)
==
'false'
or
str
(
good
)
==
'False'
:
good
=
False
if
not
'user_id'
in
session
:
#no session found
log
.
debug
(
"no session found, redirect to login"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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