• R/O
  • HTTP
  • SSH
  • HTTPS

pybbs: 提交

無料の掲示板


Commit MetaInfo

修訂8841f48d6b5312184fac9cea3fc8555458705eea (tree)
時間2018-12-20 22:08:14
作者kainushi sanuki (マーシー) <yamat0jp@yaho...>
Commiterkainushi sanuki (マーシー)

Log Message

master とか temp collection とか

Change Summary

差異

--- a/pybbs.py
+++ b/pybbs.py
@@ -427,7 +427,8 @@ class MasterHandler(BaseHandler):
427427 def get(self):
428428 if self.current_user == b'admin':
429429 com = self.application.db['master'].find()
430- self.render('master.htm',com=com)
430+ sum = self.application.db['temp'].find().count()
431+ self.render('master.htm',com=com,sum=sum)
431432 else:
432433 raise web.HTTPError(404)
433434
@@ -470,16 +471,18 @@ class CleanHandler(web.RequestHandler):
470471 table = self.application.db['master']
471472 if bool == 'true':
472473 table.remove()
474+ self.application.db['temp'].remove()
473475 elif bool == 'false':
474476 for x in list(table.find()):
475477 if not 'number' in x.keys():
476478 table.remove({'_id':x['_id']})
477479 else:
478480 item = self.application.db[x['db']].find_one({'number':int(x['num'])})
479- if not item or item['raw'] == '':
481+ if (not item)or(item['raw'] == ''):
480482 table.remove({'_id':x['_id']})
481483 com = self.application.db['master'].find()
482- self.render('master.htm', com=com)
484+ sum = self.application.db['temp'].find().count()
485+ self.render('master.htm', com=com, sum=sum)
483486
484487 class FooterModule(web.UIModule):
485488 def render(self,number,url,link):
--- a/templates/master.htm
+++ b/templates/master.htm
@@ -16,4 +16,5 @@
1616 <form action=/clean?all=true method=post>
1717 {% module xsrf_form_html() %}
1818 <p>全ての報告を<input type=submit value=削除></form>
19+<p>(temp count {{sum}})</p>
1920 </body></html>
\ No newline at end of file
Show on old repository browser