OSDN Git Service

search page
authoryamat0jp <yamat0jp@yahoo.co.jp>
Fri, 18 Nov 2016 08:39:34 +0000 (17:39 +0900)
committeryamat0jp <yamat0jp@yahoo.co.jp>
Fri, 18 Nov 2016 08:39:34 +0000 (17:39 +0900)
__pycache__/index.cpython-35.pyc
index.py
pybbs/.DS_Store
pybbs/archives.htm [deleted file]
pybbs/modules/content.htm [deleted file]
pybbs/setup.htm [deleted file]
static/db/db.json

index 83e21fb..c1ad6cb 100644 (file)
Binary files a/__pycache__/index.cpython-35.pyc and b/__pycache__/index.cpython-35.pyc differ
index df2b304..efc1df5 100755 (executable)
--- a/index.py
+++ b/index.py
@@ -2,7 +2,6 @@
 import os.path
 import tornado.auth
 import tornado.escape
-import tornado.options
 import tornado.web
 from tinydb import TinyDB,Query,where
 from tinydb.operations import delete
@@ -197,25 +196,16 @@ class UserHandler(tornado.web.RequestHandler):
       
 class SearchHandler(tornado.web.RequestHandler):       
     def post(self,dbname):
-        self.word = self.get_argument('word1')
-        self.radiobox = self.get_argument('filter')
-        self.set_cookie('search',self.word)
-        table = self.application.db.table(dbname)
-        self.render('modules/search.htm',records=self.mylist(table.all()),word1=self.word,db=dbname)
+        word = self.get_argument('word1')
+        radiobox = self.get_argument('filter')
+        self.set_cookie('search',word)
+        table = self.application.db.table(dbname)            
+        self.render('modules/search.htm',records=table.search(where(radiobox).matches(word)),word1=word,db=dbname)
     
     def get(self,dbname):
         word = self.get_cookie('search')
         self.render('modules/search.htm',records={},word1=word,db=dbname)
         
-    def mylist(self,rec):
-        for searchrec in rec:       
-            if self.radiobox == 'name':
-                if searchrec['name'].find(self.word) == True:
-                    yield searchrec
-            else:
-                if searchrec['comment'].find(self.word) == True:
-                    yield searchrec
-        
 class FooterModule(tornado.web.UIModule):
     def render(self,number,url,link):
         return self.render_string('modules/footer.htm',index=number,url=url,link=link)
index 1572d0a..26b0be9 100755 (executable)
Binary files a/pybbs/.DS_Store and b/pybbs/.DS_Store differ
diff --git a/pybbs/archives.htm b/pybbs/archives.htm
deleted file mode 100755 (executable)
index fecfc43..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML>\r
-\r
-<html>\r
-  <head>\r
-    <meta charset==utf-8>\r
-    <title>\83A\81[\83J\83C\83u</title>\r
-  </head>\r
-    <#archives>\r
-  <body>\r
-\r
-  </body>\r
-</html>\r
-\r
diff --git a/pybbs/modules/content.htm b/pybbs/modules/content.htm
deleted file mode 100755 (executable)
index e69de29..0000000
diff --git a/pybbs/setup.htm b/pybbs/setup.htm
deleted file mode 100755 (executable)
index 0a0125b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-
-<html>
-  <head>
-    <title><#title></title>
-    <meta charset="utf-8">
-  </head>
-
-  <body>
-    <br>
-    <form action="<#home>/setup" method="post">
-        <p>title1 :\r
-</p>
-      <input value="<#title>" name="title">
-    <br><br><br>
-    <p>title2 :\r
-</p>\r
-    <textarea style="HEIGHT: 97px; WIDTH: 403px" cols="3" name="title2"><#title2></textarea>
-    <br><br><br><br>
-    <input type="submit" value="\90Ý\92è">
-    </form>
-  </body>
-</html>
index 6f5cd28..2fe0700 100644 (file)
@@ -1 +1 @@
-{"bbs1": {}, "_default": {"5": {"title": "pybbs", "kinds": "conf", "password": "admin", "mentenance": false, "title2": "pybbs", "count": 30}}, "bbs2": {}, "bbs": {}, "bbs3": {}}
\ No newline at end of file
+{"bbs3": {}, "bbs2": {}, "bbs": {"1": {"comment": "<p>testing now", "number": 1, "name": "\u7ba1\u7406\u8005", "password": "", "date": "2016/11/17/16:37", "title": "\u30c6\u30b9\u30c8"}, "2": {"comment": "<p>\uff12\u4ef6\u76ee\u306e\u8a18\u4e8b\u3067\u3057\u3087\u3046\u304b", "number": 2, "name": "master", "password": "", "date": "2016/11/17/16:38", "title": "\u30c6\u30b9\u30c8"}, "3": {"comment": "<p>\u3053\u306e\u63b2\u793a\u677f\u306f\u3059\u3054\u3044\u3067\u3059\u304c\u307e\u3060\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067\u3057\u304b\u30c6\u30b9\u30c8\u306b\u6210\u529f\u3057\u3066\u3044\u307e\u305b\u3093\r\n<p>\u305d\u308c\u304c\u6b8b\u5ff5\u306a\u3068\u3053\u308d\u3067\u3059", "number": 3, "name": "master", "password": "", "date": "2016/11/18/16:05", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057."}}, "_default": {"5": {"title2": "pybbs", "mentenance": false, "count": 30, "password": "admin", "title": "pybbs", "kinds": "conf"}}, "bbs1": {}}
\ No newline at end of file