Hello
I see this problem few weeks ago.
So maybe someone find it and make a ticket.
I can't find ticket, so I write problems and solution in this article.
Here is the original source Sage 4.1 server/notebook/twist.py line
1266~1299
class Worksheet_rating_info(WorksheetResource, resource.Resource):
def render(self, ctx):
s = self.worksheet.html_ratings_info()
return HTMLResponse(stream=message('''
<h2 align=center>Ratings for %s</h2>
<h3 align=center><a href='/home/%s'>Go to the worksheet.</a>
<br><br>
<table width=70%%align=center border=1 cellpadding=10
cellspacing=0>
<tr bgcolor="#7799bb"><td width=30em>User</td><td width=10em
align=center>Rating</td><td width=10em align=center
width=60em>Comment</td></tr>
%s
</table>
<br><br>
'''%(
self.worksheet.name(), self.worksheet.filename(), s)))
class Worksheet_rate(WorksheetResource, resource.Resource):
def render(self, ctx):
ret = '/home/' + self.worksheet.filename()
#if self.worksheet.is_rater(self.username):
# return HTMLResponse(stream=message("You have already
rated the worksheet <i><b>%s</b></i>."%
self.worksheet.name(), ret))
if user_type(self.username) == "guest":
return HTMLResponse(stream = message(
'You must <a href="/">login first</a> in order to rate
this worksheet.', ret))
rating = int(ctx.args['rating'][0])
if rating < 0 or rating >= 5:
return HTMLResponse(stream = message(
"Gees -- You can't fool the rating system that
easily!", ret))
comment = ctx.args['comment'][0]
self.worksheet.rate(rating, comment, self.username)
return HTMLResponse(stream=message("""
Thank you for rating the worksheet <b><i>%s</i></b>!
You can <a href="rating_info">see all ratings of this
worksheet.</a>
"""%
self.worksheet.name(), '/pub/'))
and here is fixed soruce.
class Worksheet_rating_info(WorksheetResource, resource.Resource):
def render(self, ctx):
s = self.worksheet.html_ratings_info()
return HTMLResponse(stream='''
<h2 align=center>Ratings for %s</h2>
<h3 align=center><a href='/home/%s'>Go to the worksheet.</a>
<br><br>
<table width=70%%align=center border=1 cellpadding=10
cellspacing=0>
<tr bgcolor="#7799bb"><td width=30em>User</td><td width=10em
align=center>Rating</td><td width=10em align=center
width=60em>Comment</td></tr>
%s
</table>
<br><br>
'''%(
self.worksheet.name(), self.worksheet.filename(), s))
class Worksheet_rate(WorksheetResource, resource.Resource):
def render(self, ctx):
ret = '/home/' + self.worksheet.filename()
#if self.worksheet.is_rater(self.username):
# return HTMLResponse(stream=message("You have already
rated the worksheet <i><b>%s</b></i>."%
self.worksheet.name(), ret))
if user_type(self.username) == "guest":
return HTMLResponse(stream = message(
'You must <a href="/">login first</a> in order to rate
this worksheet.', ret))
rating = int(ctx.args['rating'][0])
if rating < 0 or rating >= 5:
return HTMLResponse(stream = message(
"Gees -- You can't fool the rating system that
easily!", ret))
comment = ctx.args['comment'][0]
self.worksheet.rate(rating, comment, self.username)
return HTMLResponse(stream="""
Thank you for rating the worksheet <b><i>%s</i></b>!
You can <a href="rating_info">see all ratings of this
worksheet.</a>
"""%
self.worksheet.name())
The problem is that if the right result, it use message function.
message function is like this.
############################
# An error message
############################
def message(msg, cont=None):
template_dict = {'msg': msg, 'cont': cont}
return template('error_message.html', **template_dict)
It use for error page. But original source use it to show right result
such as rate and raing_info page.
Can I make a ticket for this?
누구나가 다, 자기 옆에서 눈물을 흘리며 신음하는 불행한 사람들에 비해 자기가 훨씬 더 불행하다고 생각하지요. 이게 바로 우리
가련한 인간들의 오만 중 하나입니다.
- 몬테크리스토 백작
it is the infirmity of our nature always to believe ourselves much
more unhappy than those who groan by our sides!
- The Count of Monte Cristo
c'est un des orgueils de notre pauvre humanité, que chaque homme se
croie plus malheureux qu'un autre malheureux qui pleure et qui gémit à
côté de lui
- Le Comte de Monte-Cristo
박진영 - Bak JinYeong
학부재학생 - Undergraduate
컴퓨터공학전공 - Department of Computer Engineering
정보통신공학부 - School of Information & Communication Engineering
성균관대학교 - SungKyunKwan University
블로그 -
http://nosyu.pe.kr
이메일 -
don...@skku.edu