def do_POST(self): postlength = int(self.headers['Content-Length']) print('post length:', postlength) data = self.rfile.read(int(postlength)) data = data.decode('utf-8') db = DB() updated_data = db.put(data, default_project) html = self.page_content(updated_data) self.wfile.write(html.encode('utf-8'))
def page_content(self, data=False): if not data: if G_PROJECT_NAME: db = DB() data = db.get_one(G_PROJECT_NAME) else: data = default_project ui = UI(data) page = ui.build_webpage() return page