summaryrefslogtreecommitdiff
path: root/cgi-bin/edit.py
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-07-13 21:53:49 +0800
committerchai <chaifix@163.com>2018-07-13 21:53:49 +0800
commit7ca80e57f06922e464626c7a6a1d7965e716b53f (patch)
treebda9271234720424b7dfc5c2d25b9df4ba3d01df /cgi-bin/edit.py
parent181b206863d3765fe5343ceea8e1e00e52ffba9e (diff)
Diffstat (limited to 'cgi-bin/edit.py')
-rw-r--r--cgi-bin/edit.py46
1 files changed, 0 insertions, 46 deletions
diff --git a/cgi-bin/edit.py b/cgi-bin/edit.py
deleted file mode 100644
index b0a899d..0000000
--- a/cgi-bin/edit.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!D:/Programs/Python3/python.exe
-# -*- coding: utf-8 -*-
-import cgi, cgitb
-import pymysql
-import sys, codecs
-import configparser, codecs
-import connect
-from connect import Connect
-import config
-from config import Config
-import path
-from path import Path
-
-sys.stdout = codecs.getwriter('utf8')(sys.stdout.buffer)
-print("Content-type:text/html\n")
-form = cgi.FieldStorage()
-w = form.getvalue('w')
-if w == None:
- print("Invalid whisper")
-else:
- db = Connect.produce()
- cursor = db.cursor()
-
- query_whisper = "select * from whisper where id={0}".format(w)
- cursor.execute(query_whisper)
- whisper = cursor.fetchone()
-
- edit_file = open(Path.template("edit.html"), 'r', encoding="utf8")
- edit_templ = edit_file.read()
- edit_file.close()
-
- _url = Config.get("route", "url")
- _static = Config.get("route", "static")
-
- edit_html = edit_templ.format( \
- url = _url,
- static = _static,
- whisper_id = w,
- whisper_content = whisper[1]
- )
-
- print(edit_html)
-
- db.commit()
- cursor.close()
- db.close()