OSDN Git Service

restore better
authoryamat0jp <yamat0jp@yahoo.co.jp>
Sun, 20 Nov 2016 00:07:41 +0000 (09:07 +0900)
committeryamat0jp <yamat0jp@yahoo.co.jp>
Sun, 20 Nov 2016 00:07:41 +0000 (09:07 +0900)
__pycache__/index.cpython-35.pyc
index.py
static/db/db.json

index b9db2ca..4eef317 100644 (file)
Binary files a/__pycache__/index.cpython-35.pyc and b/__pycache__/index.cpython-35.pyc differ
index 8ce5012..69eb0f0 100755 (executable)
--- a/index.py
+++ b/index.py
@@ -227,18 +227,19 @@ class AdminConfHandler(BaseHandler):
         
     def store(self):
         self.application.db.close()
-        shutil.copy('static/db/db.json','static/db/bak.json')
+        shutil.copy(json,bak)
         self.application.db = TinyDB(json)
         
     def restore(self):
         database = self.application.db
-        bak = TinyDB('static/db/bak.json')
+        bak = TinyDB(bak)
         for x in database.tables():
             if self.application.collection(x) == True:
                 database.purge_table(x)
                 if x in bak.tables():
                     table = database.table(x)
                     table.insert_multiple(bak.table(x).all())
+        restart()
           
 class UserHandler(tornado.web.RequestHandler):
     def post(self,dbname):
@@ -301,6 +302,7 @@ class Application(tornado.web.Application):
             return False
 
 json = 'static/db/db.json'
+bak = 'static/db/bak.json'
 app = Application()
 
 def restart():
index 6560ad4..96c6875 100644 (file)
@@ -1 +1 @@
-{"bbs1": {"1": {"comment": "<p>writing ok\r\n<p>\r\n<p>\u7a7a\u767d\u884c\u304c\u8868\u793a\u3055\u308c\u306a\u304f\u306a\u3063\u3066\u3044\u307e\u3057\u305f", "title": "sandbox", "date": "2016/11/20 08:29", "name": "\u8ab0\u304b\u3055\u3093", "number": 1, "password": ""}, "2": {"comment": "<p>\u7a7a\u767d\r\n</p><p>\r\n</p><p>\u3000\u5217\u958b\u3051</p>", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "date": "2016/11/20 08:32", "name": "\u8ab0\u304b\u3055\u3093", "number": 2, "password": ""}, "3": {"comment": "<p>\u7a7a\u767d\r\n</p><p>\r\n</p><p>\u3000\u5217\u3042\u3051</p>", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "date": "2016/11/20 08:34", "name": "\u8ab0\u304b\u3055\u3093", "number": 3, "password": ""}, "4": {"comment": "<p>\u7a7a\u767d\r\n<br><p>\r\n<br><p>\u3000\u5217\u3042\u3051<br>", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "date": "2016/11/20 08:34", "name": "\u8ab0\u304b\u3055\u3093", "number": 4, "password": ""}, "5": {"comment": "<p>>> <a href=#9>9</a>>> 9\r\n<br><p>>> <a href=#8>8</a>>> 8  7\r\n<br><p>tst<br>", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "date": "2016/11/20 08:49", "name": "\u8ab0\u304b\u3055\u3093", "number": 5, "password": ""}, "6": {"comment": "<p>>> <a href=#9>9</a>>> 9\r\n<br><p>>> <a href=#8>8</a>>> 8  7\r\n<br><p>tst<br>", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "date": "2016/11/20 08:50", "name": "\u8ab0\u304b\u3055\u3093", "number": 6, "password": ""}, "7": {"comment": "<p>>> <a href=#9>9</a>\r\n<br></p><p>>> <a href=#8>8</a>  7\r\n<br></p><p>tst<br></p>", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "date": "2016/11/20 08:51", "name": "\u8ab0\u304b\u3055\u3093", "number": 7, "password": ""}, "8": {"comment": "<p>\u3053\u308c\u3067\r\n<br></p><p>\u3000\r\n<br></p><p>\r\n<br></p><p>\u3000\u3067\u304d\u305f\u304b\u3082<br></p>", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "date": "2016/11/20 08:51", "name": "\u8ab0\u304b\u3055\u3093", "number": 8, "password": ""}}, "bbs": {"1": {"comment": "<p>\u3053\u306e\u63b2\u793a\u677f\u306f\u3059\u3054\u3044\u3067\u3059\u3002\u4f55\u304c\u3059\u3054\u3044\u306e\u304b\u5229\u7528\u8005\u306b\u306f\u308f\u304b\u3089\u306a\u3044\u3067\u3057\u3087\u3046\u3051\u308c\u3069\u3001\u7ba1\u7406\u8005\u306f\u7ba1\u7406\u304c\u3057\u3084\u3059\u3044\u3067\u3059\u3002\u7c21\u5358\u306b\u904b\u7528\u3067\u304d\u307e\u3059\u3002heroku\u3067git\u3059\u308c\u3070\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30af\u30ea\u30a2\u3057\u3066\u3059\u3050\u4f7f\u3048\u308b\u72b6\u614b\u306b\u306a\u308a\u307e\u3059\u3002\u6c17\u306b\u3057\u306a\u3044\u4eba\u306f\u305d\u306e\u307e\u307e\u4f7f\u3048\u307e\u3059\u3002\r\n<p>\u3000tornado\u3092\u4f7f\u7528\u3057\u3066\u66f8\u304b\u308c\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304c\u5927\u5909\u7c21\u7d20\u3067\u3059\u3002\u306a\u304a\u304b\u3064\u30d6\u30ed\u30b0\u30b7\u30b9\u30c6\u30e0\u306b\u30a2\u30c3\u30d7\u304c\u30b0\u30ec\u30fc\u30c9\u3055\u305b\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002\r\n<p>\u3000\u63b2\u793a\u677f\u306e\u7ba1\u7406\u306b\u5fc5\u8981\u306a\u62e1\u5f35\u3067\u3059\u304c\u30c1\u30e3\u30f3\u30cd\u30eb\u306e\u8ffd\u52a0\u306f\u7ba1\u7406\u8005\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u8ffd\u52a0\u3057\u305f\u3044URL\u3092\u6253\u3061\u8fbc\u3080\u3060\u3051\u3002\u305d\u3046\u3059\u308c\u3070\u81ea\u52d5\u3067\u4f5c\u6210\u3055\u308c\u305f\u65b0\u3057\u3044\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u304f\u308c\u307e\u3059\u3002\r\n<p>\u3000\u3055\u3042\u4f7f\u3044\u305f\u304f\u306a\u308a\u307e\u3057\u305f\u304b\u3002", "title": "\u3053\u306eBBS\u306f\u3059\u3054\u3044\u3067\u3059\u3002\u3002\u3002\uff20\uff20\uff1b", "date": "2016/11/18/16:17", "name": "None", "number": 1, "password": ""}}, "bbs3": {}, "bbs2": {}, "_default": {"1": {"bad_words": ["<style", "<link", "<script", "<img"], "mentenance": false, "title": "pybbs", "out_words": ["\u6b7b\u306d", "\u963f\u5446", "\u30a2\u30db", "\u99ac\u9e7f", "\u30d0\u30ab"], "kinds": "conf", "password": "admin", "count": 30, "title2": "<h1 style=color:gray;text-align:center>pybbs</h1>"}}}
\ No newline at end of file
+{"bbs1": {"1": {"password": "", "name": "\u8ab0\u304b\u3055\u3093", "title": "sandbox", "number": 1, "comment": "<p>writing ok\r\n<p>\r\n<p>\u7a7a\u767d\u884c\u304c\u8868\u793a\u3055\u308c\u306a\u304f\u306a\u3063\u3066\u3044\u307e\u3057\u305f", "date": "2016/11/20 08:29"}, "2": {"password": "", "name": "\u8ab0\u304b\u3055\u3093", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "number": 2, "comment": "<p>\u7a7a\u767d\r\n</p><p>\r\n</p><p>\u3000\u5217\u958b\u3051</p>", "date": "2016/11/20 08:32"}, "3": {"password": "", "name": "\u8ab0\u304b\u3055\u3093", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "number": 3, "comment": "<p>\u7a7a\u767d\r\n</p><p>\r\n</p><p>\u3000\u5217\u3042\u3051</p>", "date": "2016/11/20 08:34"}, "4": {"password": "", "name": "\u8ab0\u304b\u3055\u3093", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "number": 4, "comment": "<p>\u7a7a\u767d\r\n<br><p>\r\n<br><p>\u3000\u5217\u3042\u3051<br>", "date": "2016/11/20 08:34"}, "5": {"password": "", "name": "\u8ab0\u304b\u3055\u3093", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "number": 5, "comment": "<p>>> <a href=#9>9</a>>> 9\r\n<br><p>>> <a href=#8>8</a>>> 8  7\r\n<br><p>tst<br>", "date": "2016/11/20 08:49"}, "6": {"password": "", "name": "\u8ab0\u304b\u3055\u3093", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "number": 6, "comment": "<p>>> <a href=#9>9</a>>> 9\r\n<br><p>>> <a href=#8>8</a>>> 8  7\r\n<br><p>tst<br>", "date": "2016/11/20 08:50"}, "7": {"password": "", "name": "\u8ab0\u304b\u3055\u3093", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "number": 7, "comment": "<p>>> <a href=#9>9</a>\r\n<br></p><p>>> <a href=#8>8</a>  7\r\n<br></p><p>tst<br></p>", "date": "2016/11/20 08:51"}, "8": {"password": "", "name": "\u8ab0\u304b\u3055\u3093", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "number": 8, "comment": "<p>\u3053\u308c\u3067\r\n<br></p><p>\u3000\r\n<br></p><p>\r\n<br></p><p>\u3000\u3067\u304d\u305f\u304b\u3082<br></p>", "date": "2016/11/20 08:51"}, "9": {"password": "", "name": "\u8ab0\u304b\u3055\u3093", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "number": 9, "comment": "<p>test\r\n<p>\r\n<p>im\r\n<p>\r\n<p> test now", "date": "2016/11/20 08:53"}, "10": {"password": "", "name": "\u8ab0\u304b\u3055\u3093", "title": "\u30bf\u30a4\u30c8\u30eb\u306a\u3057.", "number": 10, "comment": "<p>test<br></p><p><br></p><p><br></p><p>simasu<br></p>", "date": "2016/11/20 08:56"}}, "bbs2": {}, "bbs": {"1": {"password": "", "number": 1, "name": "None", "title": "\u3053\u306eBBS\u306f\u3059\u3054\u3044\u3067\u3059\u3002\u3002\u3002\uff20\uff20\uff1b", "comment": "<p>\u3053\u306e\u63b2\u793a\u677f\u306f\u3059\u3054\u3044\u3067\u3059\u3002\u4f55\u304c\u3059\u3054\u3044\u306e\u304b\u5229\u7528\u8005\u306b\u306f\u308f\u304b\u3089\u306a\u3044\u3067\u3057\u3087\u3046\u3051\u308c\u3069\u3001\u7ba1\u7406\u8005\u306f\u7ba1\u7406\u304c\u3057\u3084\u3059\u3044\u3067\u3059\u3002\u7c21\u5358\u306b\u904b\u7528\u3067\u304d\u307e\u3059\u3002heroku\u3067git\u3059\u308c\u3070\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30af\u30ea\u30a2\u3057\u3066\u3059\u3050\u4f7f\u3048\u308b\u72b6\u614b\u306b\u306a\u308a\u307e\u3059\u3002\u6c17\u306b\u3057\u306a\u3044\u4eba\u306f\u305d\u306e\u307e\u307e\u4f7f\u3048\u307e\u3059\u3002\r\n<p>\u3000tornado\u3092\u4f7f\u7528\u3057\u3066\u66f8\u304b\u308c\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304c\u5927\u5909\u7c21\u7d20\u3067\u3059\u3002\u306a\u304a\u304b\u3064\u30d6\u30ed\u30b0\u30b7\u30b9\u30c6\u30e0\u306b\u30a2\u30c3\u30d7\u304c\u30b0\u30ec\u30fc\u30c9\u3055\u305b\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002\r\n<p>\u3000\u63b2\u793a\u677f\u306e\u7ba1\u7406\u306b\u5fc5\u8981\u306a\u62e1\u5f35\u3067\u3059\u304c\u30c1\u30e3\u30f3\u30cd\u30eb\u306e\u8ffd\u52a0\u306f\u7ba1\u7406\u8005\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u8ffd\u52a0\u3057\u305f\u3044URL\u3092\u6253\u3061\u8fbc\u3080\u3060\u3051\u3002\u305d\u3046\u3059\u308c\u3070\u81ea\u52d5\u3067\u4f5c\u6210\u3055\u308c\u305f\u65b0\u3057\u3044\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u304f\u308c\u307e\u3059\u3002\r\n<p>\u3000\u3055\u3042\u4f7f\u3044\u305f\u304f\u306a\u308a\u307e\u3057\u305f\u304b\u3002", "date": "2016/11/18/16:17"}}, "_default": {"1": {"password": "admin", "count": 30, "out_words": ["\u6b7b\u306d", "\u963f\u5446", "\u30a2\u30db", "\u99ac\u9e7f", "\u30d0\u30ab"], "kinds": "conf", "title2": "<h1 style=color:gray;text-align:center>pybbs</h1>", "title": "pybbs", "bad_words": ["<style", "<link", "<script", "<img"], "mentenance": false}}, "bbs3": {}}
\ No newline at end of file