-import tornado.wsgi
-import wsgiref.simple_server
import os.path
import tornado.auth
import tornado.escape
-import tornado.httpserver
-import tornado.ioloop
import tornado.options
import tornado.web
-from tornado.options import define,options
from tinydb import TinyDB,Query,where
from tinydb.operations import delete
from datetime import datetime
-define('port',default=8000,help='run on the given port.',type=int)
-
class BaseHandler(tornado.web.RequestHandler):
def get_current_user(self):
user = self.get_secure_cookie('admin_user')
class NaviHandler(tornado.web.RequestHandler):
def get(self):
- self.render('top.htm',coll=sorted(self.name()))
+ self.render('top.htm',coll=sorted(self.name()),full=self.full)
def name(self):
for x in self.application.db.tables():
if x != '_default':
yield x
+
+ def full(self,dbname):
+ if dbname in self.application.db.tables():
+ i = 10*self.application.db.get(where('kinds') == 'conf')['count']
+ table = self.application.db.table(dbname)
+ if len(table) >= i:
+ return True
+ return False
class RegistHandler(tornado.web.RequestHandler):
def post(self,dbname):
'ui_modules':{'Footer':FooterModule},
'cookie_secret':'bZJc2sWbQLKos6GkHn/VB9oXwQt8SOROkRvJ5/xJ89E=',
'xsrf_cookies':True,
- #'debug':True,
+ 'debug':True,
'login_url':'/login'
}
tornado.web.Application.__init__(self,handlers,**settings)
<title>Top Page</title>
</head>
<body>
+<header><h1 style=text-align:center>無料電子掲示板へようこそ</h1></header>
{% for x in coll %}
+ {% if full(x) == True %}
+ <p><a href=/{{x}} style=color:red>{{x}}</a>
+ {% else %}
<p><a href=/{{x}}>{{x}}</a>
+ {% end %}
{% end %}
+<footer>PR リンク
+<p><a href=https://www.amazon.co.jp/%E9%AB%98%E6%A0%A1%E5%8D%92%E6%A5%AD%E3%81%BE%E3%81%A7%E3%81%AE%E3%82%B5%E3%83%83%E3%82%AB%E3%83%BC%E6%88%A6%E8%A1%93-sanuki_kainushi-ebook/dp/B00AXBM08Q/ref=sr_1_7?ie=UTF8&qid=1479369992&sr=8-7&keywords=sanuki_kainushi>高校卒業までのサッカー戦術</a><br>
+amazon kindle</p>
+<p>
+<p><a href=https://www.amazon.co.jp/%E4%B8%AD%E5%AD%A6%E5%8D%92%E6%A5%AD%E3%81%BE%E3%81%A7%E3%81%AE%E3%82%B5%E3%83%83%E3%82%AB%E3%83%BC%E6%88%A6%E8%A1%93-sanuki_kainushi-ebook/dp/B014X0S874/ref=sr_1_3?s=digital-text&ie=UTF8&qid=1479370246&sr=1-3>中学卒業までのサッカー戦術</a><br>
+amazon kindle</p>
+</footer>
</body>
</html>
\ No newline at end of file
-{"_default": {"5": {"title": "pybbs", "kinds": "conf", "password": "admin", "count": 30, "mentenance": false, "title2": "pybbs"}}, "bbs3": {}, "bbs1": {"1": {"title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "password": "", "date": 1, "number": 1, "name": "taro", "comment": "<p>test"}}, "bbs2": {}, "bbs": {}}
\ No newline at end of file
+{"bbs3": {}, "bbs2": {}, "bbs1": {"3": {"title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "password": "", "date": 1, "number": 3, "name": "taro", "comment": "<p>efef"}, "9": {"title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "password": "", "date": 1, "number": 9, "name": "taro", "comment": "<p>efef"}, "8": {"title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "password": "", "date": 1, "number": 8, "name": "taro", "comment": "<p>efef"}, "5": {"title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "password": "", "date": 1, "number": 5, "name": "taro", "comment": "<p>off"}, "7": {"title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "password": "", "date": 1, "number": 7, "name": "taro", "comment": "<p>efef"}, "4": {"title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "password": "", "date": 1, "number": 4, "name": "taro", "comment": "<p>eefe"}, "1": {"title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "password": "", "date": 1, "number": 1, "name": "taro", "comment": "<p>test"}, "10": {"title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "password": "", "date": 1, "number": 10, "name": "taro", "comment": "<p>off"}, "6": {"title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "password": "", "date": 1, "number": 6, "name": "taro", "comment": "<p>efef"}, "2": {"title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "password": "", "date": 1, "number": 2, "name": "taro", "comment": "<p>fife"}}, "bbs": {}, "_default": {"5": {"title": "pybbs", "kinds": "conf", "password": "admin", "count": 30, "mentenance": false, "title2": "pybbs"}}}
\ No newline at end of file