|
@@ -1,6 +1,6 @@
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
-import json
|
|
|
+import pickle
|
|
|
import atexit
|
|
|
import datetime
|
|
|
|
|
@@ -17,16 +17,16 @@ app.config["APPLICATION_ROOT"] = "/vacation/api"
|
|
|
app.url_map.strict_slashes = False
|
|
|
|
|
|
try:
|
|
|
- with open(DB_FILE) as infile:
|
|
|
- db = json.load(infile)
|
|
|
+ with open(DB_FILE, "rb") as infile:
|
|
|
+ db = pickle.load(infile)
|
|
|
except FileNotFoundError:
|
|
|
db = {}
|
|
|
|
|
|
|
|
|
@atexit.register
|
|
|
def save_db(prefix=""):
|
|
|
- with open(prefix + DB_FILE, "w") as outfile:
|
|
|
- json.dump(db, outfile)
|
|
|
+ with open(prefix + DB_FILE, "wb") as outfile:
|
|
|
+ pickle.dump(db, outfile)
|
|
|
|
|
|
|
|
|
def backup_db():
|