diff options
author | chai <chaifix@163.com> | 2018-01-26 14:12:33 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-01-26 14:12:33 +0800 |
commit | 07704199616228849c17302f21dd5a5a30dbea66 (patch) | |
tree | f9a9fe0e84dfb14dbabac2ebeffb8a7ab75bb821 /cgi-bin/issue.py | |
parent | a253c861daed44aad49ae9a195c9b0bc5d309134 (diff) |
*修改
Diffstat (limited to 'cgi-bin/issue.py')
-rw-r--r-- | cgi-bin/issue.py | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/cgi-bin/issue.py b/cgi-bin/issue.py index 83f6950..19a5414 100644 --- a/cgi-bin/issue.py +++ b/cgi-bin/issue.py @@ -17,36 +17,33 @@ 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) - - +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: + print("Error: unable to fetch data \n" + e.message) |