Example #1
0
def print_operationboundary():
    obj = deal_mysql('uspset.ini')
    msg = '''select id,name from u_sp;'''
    response = obj.askdata(msg)
    headers = ["运营商"]
    print(yate.start_response())
    print(yate.include_header("运营发布"))     
   
    print("<p ><b>点击下面的运营商名称可选择要发布的频道</b></p>")            
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.tb_header(headers))     
    print(yate.start_div('channel_div'))
    print(yate.start_form("op_channels_select.py"))
    for element in response:
        print('<tr><td>')        
        print(yate.radio_button("which_sp",element)) 
        print('</tr></td>')        
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())
    print(yate.end_div())          
    obj.Close()
#! /usr/local/bin/python3
import cgitb
cgitb.enable()

import ex_7
import cgi
import yate
import glob

data_files = glob.glob("F:/github/Headfirst_python/webapp/data/*.txt")
athletes = ex_7.put_to_store(data_files)


print(yate.start_response())
print(yate.include_header("Coach Kelly's Timing Data"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("Athlete: " ))

for each_athlete in athletes:
	print(yate.radio_button("ssss",athletes[each_athlete].name))
print(yate.end_form("select"))

print(yate.include_footer({"Home":"/index.html"}))
#! /usr/bin/env python
import cgitb; cgitb.enable()
import athletemodel
import yate
import glob

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print yate.start_response()
print yate.include_header("Coach Kelly's List of Athletes")
print yate.start_form("generate_timing_data.py")
print yate.para("Select an athlete from the list to work with:")
for each_athlete in athletes:
    print yate.radio_button("which_athlete", each_athlete)
print yate.end_form("Select")
print yate.include_footer({"Home": "../index.html"})
import athletemodel
import yate  # 模板
import time
import glob  # 可以操作系统查询一个文件名列表
import json
import requests
# 启用python的cgi跟踪技术
import cgitb
cgitb.enable()

print(yate.start_response())
print(yate.include_header("List of Athletes"))
print(yate.start_form("json_generate_timing_data.py"))
print(yate.para("Select an athlete from the list"))
url = "http://192.168.1.61:8089/cgi-bin/json_back_names.py"
namelist = json.loads(requests.get(url, timeout=4).text)
try:
    time.sleep(1)  # 单线程,需要等namelist的结果返回后,才能进行下一个web请求,但是还不能解决,头大???
    for each_athlete in namelist:
        print(yate.radio_button('which_athlete', each_athlete))
except Exception as err:
    print(err)
print(yate.end_form('Select'))
print(yate.include_footer({"Home": "/index.html"}))
#!/usr/local/bin/python3
#coding=utf-8

import athletemodel
import glob
import yate

data_files = glob.glob("data/*.txt")
ath = athletemodel.put_to_store(data_files)

print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes'"))
print(yate.start_form("generate_time_data.py"))
print(yate.para("Select an athlete from the list:"))

for each in ath:
    print(yate.radio_button("which_athlete", ath[each].name))
print(yate.end_form("Select"))
print(yate.include_footer({"Home": "/index.html"}))
Example #6
0
import glob

import athletemodel
import yate

files = glob.glob("data/*.txt")
plays = athletemodel.put_to_store(files)
print(yate.start_response())
print(
    yate.include_header(
        "Coack Kelly's List of Plays, attention: data comes from pickle"))
print(yate.start_form("generate_time_data.py"))
print(yate.para("Click here to select an play you want to see"))
for play in plays:
    print(yate.radio_button("which_player", plays[play].name))
print(yate.end_form("Select to show detail"))
print(yate.include_footer({"Click here to go Home": "/index.html"}))
Example #7
0
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 12 11:50:51 2018

@author: dell]

generate_list
"""

import athletemodel
import yate
import glob

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("Select an athlete from the list to work with:"))

for each_athlete in athletes:
    print(yate.radio_button("Which_athlete", athletes[each_athlete].name))
print(yate.end_form("select"))

print(yate.include_footer({"Home": "/index.html"}))
Example #8
0
import athletemodel
import yate
import glob

data_files = glob.glob('data/*.txt')
athletes = athletemodel.put_to_store(data_files)
print(yate.start_response())
print(yate.include_header('coach kelly list of athlete'))
print(yate.start_form('generate_timing_data.py'))
print(yate.para('select an athlete from the list to work with:'))
for each_athlete in athletes:
    print(yate.radio_button('which_athlete', athletes[each_athlete].name))
print(yate.end_form('select'))

print(yate.include_footer({'Home': '/index.html'}))
Example #9
0
#!/usr/local/bin/python3

import sportlermodell
import yate
import glob

datendateien = glob.glob("daten/*.txt")
alle_sportler = sportlermodell.konserve_machen(datendateien)

print(yate.antwort_anfang())
print(yate.seitenanfang("Die Sportler von Trainer Tim"))
print(yate.form_anfang("zeitdaten_generieren.py"))
print(yate.para("Wählen Sie einen Sportler aus der Liste aus:"))

for sportler in alle_sportler:
    print(yate.radio_button("sportlerwahl", alle_sportler[sportler].name))
print(yate.form_ende("Auswählen"))
print(yate.seitenende({"Home": "/index.html"}))
Example #10
0
import athletemodel
import yate
import glob
import cgitb

# 打开错误调试
cgitb.enable()

# 获取选手
athlete_names = athletemodel.get_namesID_from_store()
# 打印响应信息
print(yate.start_response())
# 加载html头部
print(yate.include_header("NUAC's List of Athletes"))
# 加载表单开始部分
print(yate.start_form("generate_timing_data.py"))
# 打印提示
print(yate.para("Select an athlete from the list to work with:"))

# 利用For循环加载单选按钮
for athlete_name in athlete_names:
    print(yate.radio_button("which_athlete", str(athlete_name["id"]), athlete_name["name"]))
# 加载表单结束部分
print(yate.end_form("Select"))

print(yate.include_footer({"Home":"/index.html"}))
Example #11
0
import athletemodel
import yate

athletes = athletemodel.get_namesID_from_store(data_files)

print(yate.start_response())
print(yate.include_header("NUAC's List of Athletes"))
print(yate.para("Select an athlete from the list to work with:"))
print(yate.start_form("generate_timing_data.py"))

for each_athlete in athletes:
    print(yate.radio_button("which_athlete", each_athlete[0], each_athlete[1]))
print(yate.end_form("Select"))

print(yate.include_footer({"Home": "/index.html"}))
Example #12
0
import glob
import model
import yate

data_files = glob.glob("../data/*.txt")
img_dic = model.writeList(data_files)


print (img_dic)


print (yate.start_response())
print (yate.include_header("haha"))
print (yate.start_form("by my CGI"))
print (yate.para("from my data list"))
for item in img_dic:
    print(yate.radio_button("which_img",img_dic[item] ))
print(yate.end_form("Selec"))
print(yate.include_footer({"HOME": "/index.html"}))

#!/usr/local/bin/python3
import athletemodel
import yate
import glob

data_file = glob.glob("data/*.txt")
#print(data_file)
athletes = athletemodel.put_to_store(data_file)

print(yate.start_response())
print(yate.include_header("Coach Kelly's list of athlete"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("Select an Athlete from the list"))

for each_athlete in athletes:
    print(yate.radio_button("Which athlete", athletes[each_athlete]['Name']))
    #print(athletes[each_athlete])

print(yate.end_form("Select"))
print(yate.include_footer({"Home": "/index.hmtl"}))
Example #14
0
#! /usr/bin/python3

import glob

import kelly6
import yate

data_files = glob.glob("data/*.txt")
athletes = kelly6.loadfiles(data_files)

print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("Select an athlete from the list to work with:"))
for each_athlete in athletes:
    print(yate.radio_button("which_athlete", each_athlete.name))
print(yate.end_form("Select"))
print(yate.include_footer({"Home": "/index.html"}))
import cgitb
import glob
import sportlermodell
import yate

cgitb.enable()

dateien = glob.glob('data/*.txt')
alle_sportler = sportlermodell.konserve_machen(dateien)

print(yate.antwort_anfang())
print(yate.seitenanfang('Herzlisch willkommen!'))
print(yate.para('Sportler ausw&auml;hlen:'))
print(yate.form_anfang('zeitdaten_generieren.py'))
for sportler in alle_sportler:
    print(yate.radio_button('sportlerwahl', alle_sportler[sportler].name))
print(yate.form_ende('Ausw&auml;hlen'))
print(yate.seitenende({'Home': '/index.html'}))
Example #16
0
#! /usr/bin/python3

#import cgitb
#cgitb.enable()

import new_sql_model
import yate

athletes = new_sql_model.get_namesID_from_store()

print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("Select an athlete from the list to work with:"))

for each_athlete in athletes:
	print(yate.radio_button("which_athlete", each_athlete[0], each_athlete[1]))
print(yate.end_form("Select"))

print(yate.include_footer({"Home": "/index.html"}))
Example #17
0
#! /usr/bin/env python3

import glob

import athletemodel
import yate

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("Select an athlete from the list to work with:"))
for each_athlete in athletes:
    print(yate.radio_button("which_athlete", athletes[each_athlete].name))
print(yate.end_form("Select"))
print(yate.include_footer({"Home": "/index.html"}))
Example #18
0
import athletemodel
import yate
import glob

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("Select an athlete from the list to work with:"))

for athlete in athletes:
    print(yate.radio_button("which_athlete", athletes[athlete].name))
print(yate.end_form("Select"))

print(yate.include_footer({"Home": "/index.html"}))
Example #19
0

print(dir())

the_files = ['sarah2.txt', 'james2.txt', 'mikey2.txt', 'julie2.txt']
data = put_to_store(the_files)
print(data)

for each_athlete in data:
	print(data[each_athlete].name + ' ' + data[each_athlete].dob)

data_copy = get_from_store()
for each_athlete in data_copy:
	print(data_copy[each_athlete].name + ' ' + data_copy[each_athlete].dob)

print(yate.start_response())
print(yate.start_response("text/plain"))
print(yate.start_response("application/json"))
print(yate.include_header("Welcome to my home on the web!"))
print(yate.include_footer({'Home': '/index.html', 'Select': '/cgi-bin/select.py'}))
print(yate.include_footer({}))
print(yate.start_form("/cgi-bin/process-athlete.py"))
print(yate.end_form())
print(yate.end_form("Click to Confirm Your Order"))
for fab in ['John', 'Paul', 'George', 'Ringo']:
	print(yate.radio_button(fab, fab))
print(yate.u_list(['Life of Brian', 'Holy Grail']))
print(yate.header("Welcome to my home on the web"))
print(yate.header("This isa sub-sub-sub-sub-heading", 5))
print(yate.para("Was it worth the wait? We hope it was..."))
                (athlete_id, timing_data))

    cursor.execute("SELECT * FROM athletes WHERE name = ?", ("James Lee", ))
    print(cursor.fetchall(), file=sys.stderr)
    cursor.execute("SELECT * FROM timing_data WHERE athlete_id = ?", (1, ))
    print(cursor.fetchall(), file=sys.stderr)
    connection.commit()
    connection.close()

connection = sqlite3.connect("target/coach_data.sqlite")
cursor = connection.cursor()

cursor.execute("SELECT name FROM athletes")
play_names = [row[0] for row in cursor.fetchall()]

print(yate.start_response())
print(
    yate.include_header(
        "Coack Kelly's List of Plays, attention: data comes from sqlite3"))
print(yate.start_form("add_timing_data.py"))
print(yate.para("Click here to select an play you want to add timing data"))
for play_name in play_names:
    print(yate.radio_button("which_player", play_name))
print("Entering a timing value:")
print(yate.text_input("time_value"))
print(yate.end_form("Select to add or show detail"))
print(yate.include_footer({"Click here to go Home": "/index.html"}))

connection.commit()
connection.close()