diff options
author | chai <chaifix@163.com> | 2018-01-25 20:07:15 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-01-25 20:07:15 +0800 |
commit | a253c861daed44aad49ae9a195c9b0bc5d309134 (patch) | |
tree | a10782ea82b8d71a86ab2d8311ac630f0676786e /cgi-bin/issue.py | |
parent | 9b10aa27ce8aab1ba5a05369766136071f7f9957 (diff) |
修改
Diffstat (limited to 'cgi-bin/issue.py')
-rw-r--r-- | cgi-bin/issue.py | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/cgi-bin/issue.py b/cgi-bin/issue.py index 84d84a7..83f6950 100644 --- a/cgi-bin/issue.py +++ b/cgi-bin/issue.py @@ -7,10 +7,46 @@ import issuedb from issuedb import IssueDBFactory sys.stdout = codecs.getwriter('utf8')(sys.stdout.buffer) +print("Content-type:text/html\n") + db = IssueDBFactory.produce() cursor = db.cursor() +tag_unit_html_file = open("tag_unit.html", 'r', encoding='utf8') issue_html_file = open("issue.html", 'r', encoding='utf8') +issue_html = issue_html_file.read() +tag_unit_html = tag_unit_html_file.read() + + +issue = "" + +#try: +issueId = cgi.FieldStorage().getvalue("id") +cursor.execute("select * from issue where issueId={0}".format(issueId)) +issue_content = cursor.fetchall() +issue_content = issue_content[0] + +if issue_content != None: + taglist = "" + cursor.execute("SELECT * FROM tag WHERE tagId IN (SELECT tagId FROM relation WHERE issueId = {0})".format(issueId)) + tags_rows = cursor.fetchall() + for tag_row in tags_rows: + tag = tag_unit_html.format(\ + tagid = tag_row[0], \ + tag_name = tag_row[1],\ + tag_count = '' \ + ) + taglist += tag + issue = issue_html.format( \ + issueId = issue_content[0], \ + issueTitle = issue_content[1],\ + issueDescription = issue_content[2],\ + issueSolve = issue_content[3],\ + tags = taglist\ + ) +print(issue) +#except Exception, e: +#print("Error: unable to fetch data \n" + e.message) + -print("Content-type:text/html\n") |