コード例 #1
0
ファイル: yate.py プロジェクト: whst/ichttpd
def include_footer(the_wishes):
    with open(get_db_path.root_dir() + "templates/footer.html") as footf:
        foot_text = footf.read()
        wish_box_template = Template(foot_text)
        code_str = ""

    footer = Template(foot_text)
    return footer.substitute(wishes="tmp string")
コード例 #2
0
ファイル: yate.py プロジェクト: whst/ichttpd
def include_footer(the_wishes):
    with open(get_db_path.root_dir() + 'templates/footer.html') as footf:
        foot_text = footf.read()
        wish_box_template = Template(foot_text)
        code_str = ''

    footer = Template(foot_text)
    return (footer.substitute(wishes="tmp string"))
コード例 #3
0
ファイル: yate.py プロジェクト: whst/ichttpd
def include_wishes_form(the_wishes):
    code_str = ''
    with open(get_db_path.root_dir() + 'templates/form.html') as formf:
        form_text = formf.read()
        box_template = Template(form_text)
        for i in the_wishes:
            code_str += box_template.substitute(info_id=i[0],
                                                title=i[2],
                                                name='By ' + i[1],
                                                thumb_up=i[6],
                                                time=to_human_time(i[5]),
                                                wish=i[3],
                                                contact_info=i[4])
    return (code_str)
コード例 #4
0
ファイル: yate.py プロジェクト: whst/ichttpd
def include_wishes_form(the_wishes):
    code_str = ""
    with open(get_db_path.root_dir() + "templates/form.html") as formf:
        form_text = formf.read()
        box_template = Template(form_text)
        for i in the_wishes:
            code_str += box_template.substitute(
                info_id=i[0],
                title=i[2],
                name="By " + i[1],
                thumb_up=i[6],
                time=to_human_time(i[5]),
                wish=i[3],
                contact_info=i[4],
            )
    return code_str
コード例 #5
0
ファイル: yate.py プロジェクト: whst/ichttpd
def include_footer(wishes_code):
    with open(get_db_path.root_dir() + "templates/footer.html") as footf:
        foot_text = footf.read()
    footer = Template(foot_text)
    return footer.substitute(wish_boxes=wishes_code)
コード例 #6
0
ファイル: yate.py プロジェクト: whst/ichttpd
def include_header(the_title=""):
    with open(get_db_path.root_dir() + "templates/header.html") as headf:
        head_text = headf.read()
    header = Template(head_text)
    return header.substitute(title=the_title)
コード例 #7
0
ファイル: new_wish.py プロジェクト: whst/ichttpd
#!/usr/bin/python3
import yate
import wishmodel
import cgi
from change_wish_data import add_wish
import get_db_path

form_data = cgi.FieldStorage()

add_wish(form_data.getvalue('nickname'), form_data.getvalue('title'),
        form_data.getvalue('wish'), form_data.getvalue('contact_info'));

print('Content-type: text/html\n')

with open(get_db_path.root_dir() + 'templates/done_post.html') as done_postf:
  print(done_postf.read())
コード例 #8
0
ファイル: thumb_up.py プロジェクト: whst/ichttpd
#!/usr/bin/python3
import wishmodel
import cgi
import yate
from change_wish_data import add_thumb_up
import get_db_path

form_data = cgi.FieldStorage()
info_id = form_data.keys()[0]  #取得name,name本身代表了数据库里ID
add_thumb_up(info_id)

#写返回页面
print('Content-type: text/html\n')
with open(get_db_path.root_dir() +
          'templates/done_thumb_up.html') as done_thumb_upf:
    print(done_thumb_upf.read())
コード例 #9
0
ファイル: new_wish.py プロジェクト: whst/ichttpd
#!/usr/bin/python3
import yate
import wishmodel
import cgi
from change_wish_data import add_wish
import get_db_path

form_data = cgi.FieldStorage()

add_wish(
    form_data.getvalue("nickname"),
    form_data.getvalue("title"),
    form_data.getvalue("wish"),
    form_data.getvalue("contact_info"),
)

print("Content-type: text/html\n")

with open(get_db_path.root_dir() + "templates/done_post.html") as done_postf:
    print(done_postf.read())
コード例 #10
0
ファイル: yate.py プロジェクト: whst/ichttpd
def include_footer(wishes_code):
    with open(get_db_path.root_dir() + 'templates/footer.html') as footf:
        foot_text = footf.read()
    footer = Template(foot_text)
    return (footer.substitute(wish_boxes=wishes_code))
コード例 #11
0
ファイル: yate.py プロジェクト: whst/ichttpd
def include_header(the_title=''):
    with open(get_db_path.root_dir() + 'templates/header.html') as headf:
        head_text = headf.read()
    header = Template(head_text)
    return (header.substitute(title=the_title))
コード例 #12
0
ファイル: thumb_up.py プロジェクト: whst/ichttpd
#!/usr/bin/python3
import wishmodel
import cgi
import yate
from change_wish_data import add_thumb_up
import get_db_path

form_data = cgi.FieldStorage()
info_id = form_data.keys()[0] #取得name,name本身代表了数据库里ID
add_thumb_up(info_id)

#写返回页面
print('Content-type: text/html\n')
with open(get_db_path.root_dir() + 'templates/done_thumb_up.html') as done_thumb_upf:
  print(done_thumb_upf.read())