Skip to content

Commit

Permalink
修复分页函数一处BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
时雨 committed May 11, 2015
1 parent 932152c commit 08c3292
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion controller/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def pagenav(self, count, url, each, now,
_ret = u'<li><a class="am-link-muted" href="%s">首页</a></li><li class="am-disabled"><a href="#">...</a></li>%s' % (_url, _ret)
if now + 5 < page:
_url = url % page
_ret = u'%s<li class="am-disabled"><a href="#">...</a></li><li><a class="am-link-muted" href="%s%d">尾页</a></li>' % (_ret, _url)
_ret = u'%s<li class="am-disabled"><a href="#">...</a></li><li><a class="am-link-muted" href="%s">尾页</a></li>' % (_ret, _url)
if page <= 1:
_ret = ''
_ret = _pre + _ret + _end
Expand Down
6 changes: 5 additions & 1 deletion controller/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ def prepare(self):
self.redirect("/")

def render(self, template_name, **kwargs):
super(AdminHandler, self).render("admin/%s" % template_name, **kwargs)
if self.power == "admin":
render = "admin/%s" % template_name
else:
render = template_name
super(AdminHandler, self).render(render, **kwargs)

def get(self, *args, **kwargs):
action = args[0] if len(args) else "index"
Expand Down
6 changes: 0 additions & 6 deletions controller/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,6 @@ class UploadHandler(BaseHandler):
def prepare(self):
super(UploadHandler, self).prepare()
self.orgname = ''
self.set_header("X-Frame-Options", "SAMEORIGIN")
self.set_header("Content-Security-Policy", "default-src 'self'; script-src 'self' 'unsafe-eval' "
"'unsafe-inline'; connect-src 'self'; img-src 'self' data:; "
"style-src 'self' 'unsafe-inline'; font-src 'self'; frame-src 'self';")

def check_xsrf_cookie(self):
return True
Expand Down Expand Up @@ -204,8 +200,6 @@ def post(self, *args, **kwargs):
except tornado.web.Finish, e:
pass
except:
import traceback
print traceback.print_exc()
self.end(False, u"参数错误")

def end(self, status, info, path = ""):
Expand Down

0 comments on commit 08c3292

Please sign in to comment.