Exemplo n.º 1
0
def channels_offline(channel_offline=True):
    message = ("""SELECT ulv_genchannels.channel_id,
    tvs_channel.chname, 
    ulv_genaddress.gen_address, 
    ulv_status.des
    FROM ulv_genchannels
    NATURAL JOIN tvs_channel, ulv_genaddress, ulv_status
    WHERE ulv_genchannels.channel_id = tvs_channel.chid 
    AND tvs_channel.chid = ulv_genaddress.channel_id 
    AND ulv_status.status_id=1 order by ulv_genchannels.sort_id, ulv_genchannels.channel_id""")

    conn = my_sql.connect()
    cursor = conn.cursor()
    cursor.execute(message)
    result = cursor.fetchall()
    conn.close()
    
    headers = ["频道名称", "频道编号", "直播路径", "发布状态"]
    print(yate.start_response())
    if channel_offline:
        print(yate.include_header("频道下线"))
    else:
        print(yate.include_header("已发布频道"))
    print(yate.start_form("ft_channels_offline.py"))
    print(yate.start_table(tb_width="100%", tb_border="1px solid"))
    print(yate.tb_header(headers))
    
    for array in result:
        print(yate.do_table(array, channel_offline))

    print(yate.end_table())
    if channel_offline==True:
        print(yate.end_form("确定"))
Exemplo n.º 2
0
def select_sp():    
    
    obj = deal_mysql("uspset.ini")
    msg =  '''select id,name from u_sp'''
    results = obj.askdata(msg)
    obj.Close()
    
    headers = ["运营商名称"]
    print(yate.start_response())
  
    print(yate.include_header("首页运营"))

    print(yate.start_form("op_guidepage_arrange.py"))    
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.tb_header(headers))
    for array in results:
        print(yate.start_row())
        print(yate.checked_radio_button('which_spid',[array[0],array[1]]))
        print(yate.end_row())
    print(yate.end_table())
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())        
Exemplo n.º 3
0
def ft_channels_edit_second():
    start_response()
    chid = get_formData('which_chid')
    obj = deal_mysql()
    msg = ("""SELECT ulv.channel_id,tvs.chname,ulv.gen_address 
    from ulv_genaddress as ulv inner join tvs_channel as tvs 
    on ulv.channel_id=tvs.chid and ulv.channel_id=%s""" % chid[0])
    result = obj.askdata(msg)
    info = result.pop(0)  
    headers = ["频道信息"]   
    print(yate.include_header("频道修改"))       
    print(yate.start_form("ft_channels_editDone.py"))
    print(yate.start_table(tb_width="100%", tb_border="1px solid"))
    print(yate.tb_header(headers))       
    print(yate.start_row())
    print(yate.checked_radio_button('which_chid',[info[0],info[1]]))
    print(yate.end_row()) 
    print(yate.start_row())
    print(yate.input_text("which_addr",info[2]))
    print(yate.end_row())     
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())
    obj.Close()  
Exemplo n.º 4
0
def ft_channels_editFirst():    
    obj = deal_mysql()
    msg = ('''SELECT ulv.channel_id,tvs.chname 
    from ulv_genchannels as ulv
    inner join tvs_channel as tvs
    on tvs.chid=ulv.channel_id order by ulv.sort_id, ulv.channel_id;''')
    
    result = obj.askdata(msg)
    headers = ["频道名称"]
    print(yate.start_response())
    print(yate.include_header("频道维护"))       
    print(yate.start_form("ft_channels_edit.py"))
    print(yate.start_table(tb_width="100%", tb_border="1px solid"))
    print(yate.tb_header(headers))  
    print(yate.start_row())
    print(yate.select('which_chid'))
    #for array in result:        
    print(yate.select_option(result))
    print(yate.end_select())
    print(yate.end_row()) 
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())   
    obj.Close()
Exemplo n.º 5
0
def channels():
    message = """select live_channel.chid,tvs_channel.chname,live_server.live_ip,live_url.live_path,live_status.sname """
    message += """from tvs_channel,live_channel,live_server,live_url,live_status where tvs_channel.chid=live_channel.chid and """
    message += """live_status.statusid=live_channel.statusid and live_url.live_urlid=live_channel.live_urlid and live_url.serverid = live_server.serverid """
    message += """and live_url.status=0 order by live_channel.chid """

    conn = my_sql.connect()
    cursor = conn.cursor()
    cursor.execute(message)
    result = cursor.fetchall()
    conn.close()
    
    headers = ["频道名称", "直播地址", "直播路径", "发布状态"]
    print(yate.start_response())
    print(yate.include_header("JSB living system"))
    print(yate.start_form("edit.py"))
    print(yate.start_table(tb_width="80%", tb_border="1px solid"))
    print(yate.tb_caption("已发布频道"))
    print(yate.tb_header(headers))

    for array in result:
        print(yate.tb_data(array[1:]))
    print(yate.end_table())
    print(yate.end_form())
    print(yate.include_footer({"Home": "/index.html"}))
Exemplo n.º 6
0
def channels_operation(sp_id):  
    chidDic  = dict() #store the checked chid from sp_id
    obj = deal_mysql()
    
    msg = ('''SELECT ulv.channel_id,tvs.chname 
    from ulv_genchannels as ulv
    inner join tvs_channel as tvs
    on tvs.chid=ulv.channel_id order by ulv.sort_id, ulv.channel_id;''')
    
    msgn = ('''SELECT chid,sp_id from ulv_opchannels where sp_id=%d''' % int(sp_id))
    
    result = obj.askdata(msg)    
    checked = obj.askdata(msgn)
    for ele in checked:
        chidDic[ele[0]] = ele[1]
    nobj = deal_mysql('uspset.ini')
    msgs = '''select name from u_sp where id=%s''' % int(sp_id)
    response = nobj.askdata(msgs)
    
    headers = ["频道名称", "频道编号"]
    print(yate.start_response())
  
    print(yate.include_header("频道运营"))

    print(yate.start_form("op_channels_generate.py"))
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    theader = ['运营商']
    print(yate.tb_header(theader))
    print(yate.start_row())
    print('<input type="radio" checked="checked" name="which_sp" value="'+(sp_id)+'"/>"'+response[0][0]+'"')
    print(yate.end_row())
    print(yate.end_table())
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.tb_header(headers))
    for array in result:
        if chidDic.get(array[0],None)==None:
            print(yate.do_operationtable(array))
        else:
            print(yate.checked_operationtable(array))
    print(yate.end_table())
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())    
    obj.Close()
    nobj.Close()
Exemplo n.º 7
0
def channels_publish():
    cmdmsg = ("""SELECT tvs_channel.chid, tvs_channel.chname
    FROM tvs_channel
    NATURAL JOIN ulv_genaddress
    WHERE tvs_channel.`status` <> 1 AND tvs_channel.chid = ulv_genaddress.channel_id
    order by tvs_channel.chid""")
    
    conn = my_sql.connect()
    cur = conn.cursor()
    cur.execute(cmdmsg)
    result = cur.fetchall()
    
    msg = ("""select sort_id,sort_name from ulv_sort""")
    cur.execute(msg)
    sortinfo = cur.fetchall()
    conn.close()

    print(yate.start_response())
    print(yate.include_header("上线频道"))
    print("<p ><b>通过下面的复选框选择要上线的频道</b></p>")    
    print(yate.start_form("ft_channels_publish.py"))
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.start_row())
    print("<center>")   
    print(yate.select("channel_id"))
    print(yate.select_option(result))
    print(yate.end_select())  
    print('</center>')
    print(yate.end_row())
    
    print(yate.start_row())
    print("<center>")
    print(yate.select("sort_id"))
    print(yate.select_option(sortinfo))
    print(yate.end_select()) 
    print('</center>')
    print(yate.end_row())    
    
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())
Exemplo n.º 8
0
def do_web_process():
    #test functions for yate.py
    print(yate.start_response())
    print(yate.start_response("text/plain"))
    print(yate.start_response("application/json"))
    print(yate.include_header("Test title for my web application in python test"))
    print(yate.include_footer({'Home':'/index.html', 'Select':'/cgi-bin/select.py'}))
    print(yate.start_form("/cgi-bin/process-athlete.py"))
    #print(urllib.request.urlopen('http://192.168.0.1/test.py', urllib.parse.urlencode({'a':'c'})))
    print(urllib.parse.urlencode({'a':'c'}))
    
    the_files = ['testdata/sarah2.txt', 'testdata/james2.txt', 'testdata/mikey2.txt']
    data = put_to_store(the_files)
    for each_data in data:
        print(data[each_data].name+' '+data[each_data].dob)
    data_copy = get_from_store()
    for each_data in data_copy:
        print(data_copy[each_data].name+' '+data_copy[each_data].dob)
    #start simple http server for test
    simple_http_server_test()
    pass
Exemplo n.º 9
0
def channels_collect():
    start_response()    
    obj = deal_mysql()
    msg = ("""SELECT chid,chname from tvs_channel where status=0""")         
    result = obj.askdata(msg)
    #info = result.pop(0)  
    headers = ["频道信息"]   
    print(yate.include_header("新频道收录"))       
    print(yate.start_form("ft_channels_collectDone.py"))
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.tb_header(headers))       
    print(yate.start_row())   
    print(yate.select('which_chid'))               
    print(yate.select_option(result))
    print(yate.end_select())    
    print('<input type="text" name="which_addr" />')
    print(yate.end_row())      
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())
    obj.Close()  
Exemplo n.º 10
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()
Exemplo n.º 11
0
	segCTStingListPerQuery = segQuery.segmentCTListPerQuerys(ctListPerQuery)
	return segCTStingListPerQuery

	


# cheat, init ehownet list 

## init 
set_FakeListToStore()

## 
form_data = cgi.FieldStorage()
term = form_data['terms'].value
print(yate.start_response())
print(yate.include_header("Aprori Page for " + str(term)))

## if query exist in SQL or pickle(utlmate result), check, and get the results 



### segment 
segmentedQuery = segQuery.segmentToListPerQuery(term)
print(yate.para("These are segmented query: "))
print ("<h1>" +  str(segmentedQuery) + "<h1>")
print(yate.u_list(segmentedQuery))

### look up from ehownet 
expandedQueries = get_allExpannedQueryFromStore(segmentedQuery)
print(yate.para("These are expanded queries: "))
print(yate.u_list(expandedQueries))
Exemplo n.º 12
0
# # ================== 初始化一个操作符列表 ==================
# operatelist = ['+', '-', '*', '//']
# operatelist['add'] = '+'
# operatelist['subtract'] = '-'
# operatelist['multiply'] = '*'
# operatelist['divide'] = '//'
# # ================== 初始化完毕 ==================
# operatelist = ['+', '-', '*', '//']
operatelist1 = {'加号': '+', '减号': '-', '乘号': '*', '除号': '//'}
operatelist = {}
for key in operatelist1:
    operatelist[operatelist1[key]] = key

print(yate.start_response())
print(yate.include_header('这是一个WEB应用测试页面'))

print(yate.header('%s' % ('=' * 10 + '下面是测试内容' + '=' * 10), 3))
print(yate.start_form('test_content.py'))

# for Anoperator in operatelist:
#     print(yate.checked_box('operator',Anoperator))

print(yate.select_set('operator', operatelist, 3, multiple=True))

print(yate.end_form('提交'))

footer_string = '=' * 10 + '结束' + '=' * 10

form_data = cgi.FieldStorage()
if (form_data):
Exemplo n.º 13
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 libchaos's 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"}))
Exemplo n.º 14
0
__author__ = 'micheng'

import cgi
import athletemodel
import yate

form_data = cgi.FieldStorage()
athlete_id = form_data['which_athlete'].value
athlete = athletemodel.get_athlete_from_id(athlete_id)

print(yate.start_response())
print(yate.include_header("NUAC's Timing Data"))
print(
    yate.header("Athlete: " + athlete['Name'] + ", DOB: " + athlete['DOB'] +
                '.'))
print(yate.para('The top times for this athlete are:'))
print(yate.u_list(athlete['top3']))
print(
    yate.para('The entire set of timing data is: ' + str(athlete['data']) +
              ' (duplicates removed).'))

print(
    yate.include_footer({
        "Home": "/index.html",
        "Select another athlete": "generate_list.py"
    }))
Exemplo n.º 15
0
#!/usr/local/bin/python
import cgi
import athletemodel
import yate
import sys


athletes = athletemodel.get_from_store()
form_data = cgi.FieldStorage()
athlete_name = form_data["which_athlete"].value
print(yate.start_response())
print(yate.include_header('Coach Kellys Timing Data'))
print(yate.header("Athlete: " + athlete_name + "DOB: " + athletes[athlete_name].dob + "."))
print(yate.para("Top three times for this athlete are:"))
print(yate.u_list(athletes[athlete_name].top3()))
print(yate.include_footer({"Home":"/index.html", "Select another Athlete":"/cgi-bin/generate_list.py"}))
Exemplo n.º 16
0
import cgi

import cgitb
cgitb.enable()

import athletemodel
import yate

athletes = athletemodel.get_from_store()

form_data = cgi.FieldStorage()
athlete_name = form_data['which_athlete'].value

print(yate.start_response())
print(yate.include_header("The Timing Data"))
print(yate.header("Athlete: " + athlete_name + ", DOB: " + athletes[athlete_name].dob + "."))
print(yate.para("The top times for this athlete are:"))
print(yate.u_list(athletes[athlete_name].top3))
print(yate.include_footer({"Home":"/index.html", "Select another athlete":"generate_list.py"}))

Exemplo n.º 17
0
import yate
import athletemodel
import cgi
import os

form_data = cgi.FieldStorage()
athlete_name = form_data['which_athlete'].value
#athlete_name="Sarah Sweeney"
print(yate.start_response())
print(yate.include_header(athlete_name + "'s timing"))
#print(yate.para(athlete_name+"'s timing"))
data = athletemodel.get_from_store()

athlete = data[athlete_name]
print(yate.u_list(sorted(set(athlete))[:3]))
print(
    yate.include_footer({
        "Home": "/index.html",
        "Select another athlete": "generate_list.py"
    }))  #os.path.join(os.getcwd(),"index.html")
Exemplo n.º 18
0
#! /usr/bin/python3
# -*- coding: utf-8 -*-
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("老司机 Silence 的资源收藏"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("请选择你想要深入了解的角色:"))

for each_athlete in athletes:
	print(yate.radio_button("which_athlete",athletes[each_athlete].name))
print(yate.end_form("选择"))

print(yate.include_footer({"返回首页":"/index.html"}))
Exemplo n.º 19
0
# -*- coding: utf-8 -*-
# 生成游戏页面
import sys
import yate,arithmetic_training_games

# =================生成一个HTML页面=================
print(yate.start_response())
print(yate.include_header('欢迎来到韦浩宇的算术运算训练营!'))
# print(yate.start_form('arithmetic_training_games.py'))
print(yate.para('即将开始算术训练!'))

Numlist = [x for x in range(20)]
ArtInstance = arithmetic_training_games.ArithmeticMode(Numlist,level= 2, OperatorList=['-'])

while(True):
    AnExpress = ArtInstance.get_ArtExpress()
    if(0 <= eval(AnExpress) <= 100):
        break
print(yate.header('%s = ' %(AnExpress), header_level = 1))
print(yate.header('更多算题,敬请期待!'))

# print('%s = ' %(AnExpress))

print(yate.include_footer({'Home':'/index.html'}))
Exemplo n.º 20
0
#! /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"}))
Exemplo n.º 21
0
##################################################################################
#                                                                                #
#  Copyright (c) 2013 Yao Nien, Yang, [email protected]                     #
#  Licensed under the Apache License, Version 2.0 (the "License"); you may not   #
#  use this file except in compliance with the License. You may obtain a copy    #
#  of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required #
#  by applicable law or agreed to in writing, software distributed under the     #
#  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS  #
#  OF ANY KIND, either express or implied. See the License for the specific      #
#  language governing permissions and limitations under the License.             #
#                                                                                #
##################################################################################

import cgi
import cgitb
cgitb.enable()
import athletemodel
import yate

print(yate.start_response())
print(yate.include_header("this is Normal Google search result page"))
Exemplo n.º 22
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"}))

Exemplo n.º 23
0
#!/usr/bin/python3
import yate
import wishmodel
import get_db_path

wishes = wishmodel.get_wishes_from_store()
#时间倒序排序
wishes.sort(key = lambda x:x[5], reverse=1)
#生成页面
print(yate.start_response())
print(yate.include_header("心愿墙"))
boxes = yate.include_wishes_form(wishes)
print(yate.include_footer(boxes))
Exemplo n.º 24
0
####### controller process #############3

form_data = cgi.FieldStorage()
term = form_data['terms'].value

# "results" are the JSONs list containing each page result FOR ONE QUERY [[ONE PAGE - title,content,url],[ONE PAGE - JSON]]
results = mainmodel.get_googleResult_from_firstQuery(term)

#for each in results:
#	fordiaply = each_jsonPaser(each)

for each in results:
    onePageTitles, onePageContents, onePageUrls = jsonPaserForOnePage(each)

print(yate.start_response())
print(yate.include_header("The is a search page for " + str(term)))
print(
    yate.include_menu({"satisfied, go back Google": "/index.html"}, str(term)))
#print(yate.start_form("controller2.py"))
#print(yate.input_text('terms',str(term)))
#print(yate.end_form("enter to my app"))
#print(yate.para("Query for:" + str(term)))

#print("<br /><br />")
for title, content, url in zip(onePageTitles, onePageContents, onePageUrls):
    print(yate.render_search_result(title, content, url))
#mypage = markup.page()
#mypage.addfooter("f**k you")
#print (mypage)

#print("<button type="button" onclick="alert('Hello world!')">Click Me!</button>")
Exemplo n.º 25
0
import cgi
import yate
import athletemodel

athletes = athletemodel.get_from_store()
form_data = cgi.FieldStorage()
athlete_name = form_data["which_athlete"].name

print(yate.start_response())
print(yate.include_header("Athlete's timing data:"))
#print(yate.para(athlete_name+"'s time data:"))
print(
    yate.header("Athlete:" + athlete_name + ",DOB = " +
                athletes[athlete_name].dob + '.'))
print(yate.para("The top times for this athletes are:"))
print(yate.u_list(athletes[athlete_name].top()))

print(
    yate.include_footer({
        "Home": "index.html",
        "Choose another athlete": "generate_list.py"
    }))
Exemplo n.º 26
0
__author__ = 'Dixit_Patel'

from genericFunctions import *
import athletemodel
#from athletemodel import *
import yate
import glob

data_files = glob.glob("../data/*.txt")
#print(data_files)
# print(glob.glob0('data','/*.txt'))
# print(glob.glob1('data','/*.txt'))
athletes = athletemodel.put_to_store(data_files)

# impt line - start response
print(yate.start_response())

print(yate.include_header("Home"))
print(yate.header("AthLetA"))
print(yate.para('Select an athlete from list'))
print(yate.start_form("generate_timing_data.py"))
print(type(athletes))
for athlete in athletes:
    print(yate.radio_button("which_athlete",athletes[athlete].name))
# print(yate.radio_button('James','James'))
# print(yate.radio_button('Mikey','Mikey'))
print(yate.end_form())
print(yate.include_footer({"Home": "/index.html"}))
Exemplo n.º 27
0
#! /usr/local/bin/python3

"""1. 跟DB確認帳號密碼"""
"""2. 確認OK,近入記帳頁面"""
"""3. 確認失敗,回傳失敗網頁"""

import glob
import yate

data_files = glob.glob("data/*.txt")

print(yate.start_response())
print(yate.include_header("test"))
print(yate.include_footer({"Home": "/index.html"}))
Exemplo n.º 28
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..."))
Exemplo n.º 29
0
import yate
import athletemodel
import athletelist
import cgi
import cgitb

cgitb.enable()

athletes = athletemodel.get_from_store()
form_data = cgi.FieldStorage()
athlete_name = form_data['which_athlete'].value

print(yate.start_response())
print(yate.include_header("Time Data Page"))

if athlete_name:
    print(
        yate.header(athletes[athlete_name].name + athletes[athlete_name].dob +
                    "'s timing data top 3 are:"))
    #tops=athletes[athlete_name].top3
    print(yate.u_list(athletes[athlete_name].top3))

print(athlete_name)
print(
    yate.include_footer({
        "Home": "../index.html",
        "Another Athlete": "generate_list.py"
    }))
Exemplo n.º 30
0
import cgi
import athletemodel
import yate
import cgitb
cgitb.enable()

athletes = athletemodel.get_from_store()

form_data = cgi.FieldStorage()
athlete_name = form_data['which_athlete'].value

print(yate.start_response())
print(yate.include_header("Coach Kelly's  time Data"))
print(
    yate.header("Athlete:" + athlete_name + ",DOB:" +
                athletes[athlete_name].dob + "."))

print(yate.para("The top times for this athlete are:"))
print(yate.u_list(athletes[athlete_name].top3))

print(
    yate.include_footer({
        "Home": "/index.html",
        "select another athlete": "generate_list.py"
    }))
Exemplo n.º 31
0
import cgi
import cgitb
import athletemodel
import athletelist
import yate

# This for debug.
cgitb.enable()
athletes = athletemodel.get_from_store()


form_data = cgi.FieldStorage()
athlete_name = form_data['which_athlete'].value

print(yate.start_response())
print(yate.include_header("Coach Kelly's Timing data"))
print(yate.header("Athlete: " + athlete_name + ", DOB:" +
                  athletes[athlete_name].dob + "."))
print(yate.para("The top times for this athlete are:"))
print(yate.u_list(athletes[athlete_name].top3))

print(yate.include_footer({"Home":"/index.html","Select another athlete":"generate_list.py"}))
Exemplo n.º 32
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("The 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"}))
Exemplo n.º 33
0
####### controller process #############3

form_data = cgi.FieldStorage()
term = form_data['terms'].value

# "results" are the JSONs list containing each page result FOR ONE QUERY [[ONE PAGE - title,content,url],[ONE PAGE - JSON]]
results = mainmodel.get_googleResult_from_firstQuery(term)

#for each in results:	
#	fordiaply = each_jsonPaser(each)

for each in results:	
	onePageTitles,onePageContents,onePageUrls  = jsonPaserForOnePage(each)

print(yate.start_response())
print(yate.include_header("The is a search page for " + str(term)))
print(yate.include_menu({"satisfied, go back Google": "/index.html"}, str(term) ))
#print(yate.start_form("controller2.py"))
#print(yate.input_text('terms',str(term)))
#print(yate.end_form("enter to my app"))
#print(yate.para("Query for:" + str(term)))

#print("<br /><br />")
for title, content, url in zip(onePageTitles,onePageContents,onePageUrls):
		print(yate.render_search_result(title,content,url))
#mypage = markup.page()
#mypage.addfooter("f**k you")
#print (mypage)


#print("<button type="button" onclick="alert('Hello world!')">Click Me!</button>")
Exemplo n.º 34
0
import yate, cgi
import athletemodel
form = cgi.FieldStorage()
the_id = form['which_athlete'].value
# the_athletes_name=athletemodel.
print(yate.start_response())
print(yate.include_header("Add a timing data"))
print(
    yate.do_form('add_timing_data.py',
                 the_inputs=[[the_id], ['TimeValue']],
                 method='post',
                 text='Send'))
Exemplo n.º 35
0
import athletemodel
import yate
import cgi
import cgitb
cgitb.enable()
athletes = athletemodel.get_from_store()
from_data = cgi.Fieldstorage()

athlete_name = from_data['Which_athlete'].value
print(yate.start_response())
print(yate.include_header("Dhananjay Yadav's Timing Data"))
print(yate.header("Athlete:" + athlete_name + ", Date of Birth: " + athletes[athlete_name].dob))

print(yate.para("The top three times for " + athlete_name+"are:"))

print(yate..u_list(athletes[athlete_name].top3))
print(yate.include_footer({"Home": "/index.html","select another athlete":"generate_list.py"}))
Exemplo n.º 36
0
#!/usr/bin/env python 
import MySQLdb as mdb
import cgi
import yate
from GenePic import *
from TFBS_tools import print_tfbs

con = mdb.connect('genome', 'rsnp', 'RSNP', 'testdb');

form_data = cgi.FieldStorage().getvalue('gene_id').upper()

print(yate.start_response())
print(yate.include_header("Your SNPs, served fresh and hot!"))  

genes = GenePic(form_data)

with con:
    cur = con.cursor(mdb.cursors.DictCursor)
    genes.setcursor(cur)
    cur.execute( """SELECT  TFBS.TFBS_ID   FROM    TFBS,GENE,GENE2TFBS 
                                WHERE  GENE.gene_id = %s
                                AND  GENE.gene_id = GENE2TFBS.gene_id
                                AND GENE2TFBS.TFBS_ID = TFBS.TFBS_ID """ % (form_data))
    rows = cur.fetchall()
    temp = []
    for row in rows:
        temp.append(row['TFBS_ID'])
        genes.addTFBS(row['TFBS_ID'])

    genes.drawpic()
    print'<br><br>'
Exemplo n.º 37
0
else:
    logger.info("Not found, query through Google Search API directly!")
    ## "results" are the JSONs list containing each page result FOR ONE QUERY [[ONE PAGE - title,content,url],[ONE PAGE - JSON]]
    lQueried_results_json = sql_webModel.get_googleResult_forClient(term_ascii)

    #for each in results:
    #	fordiaply = each_jsonPaser(each)

    for each_json in lQueried_results_json:
        lTitles, lContents, lUrls = myquerypaser.onePageJsonPaser(each_json)
    DATAINSTORE = False

###### start to render in html-based ###############

print(yate.start_response())
print(yate.include_header("Google search result for " + str(term_ascii)))
print(
    yate.include_menu(
        {"Are you satisfied? , go back to Google": "/index.html"},
        str(term_ascii)))
#print(yate.start_form("controller2.py"))
#print(yate.input_text('terms',str(term)))
#print(yate.end_form("enter to my app"))
#print(yate.para("Query for:" + str(term)))
#print("<br /><br />")

if DATAINSTORE:
    for title, content, url in zip(lTitles_SQL, lContents_SQL, lUrls_SQL):
        print(
            yate.render_search_result(title.encode('utf-8-sig'),
                                      content.encode('utf-8-sig'),
import cgi
import json
import athletemodel
import yate
import requests
# import cgitb
# cgitb.enable()

url = "http://127.0.0.1:8089/cgi-bin/json_back_timing_data.py"
athletes = json.loads(requests.get(url, timeout=4).text)

print(yate.start_response("application"))
print(yate.include_header("---'NUAC's Timing Data---------------"))
print(
    yate.include_header("Athlete:" + athletes['Name'] + "|dob:" +
                        athletes['Bob']))

print(yate.para("The top3 times is:"))
print(yate.u_list(athletes['top3']))

print(yate.include_footer({"Home": "/index.html"}))
print(yate.include_footer({"Other athletes":
                           "/cgi-bin/json_generate_list.py"}))
Exemplo n.º 39
0
import cgi

import cgitb
cgitb.enable()
#这两行代码启用python的CGI跟踪技术

import athletemodel
import yate

athletes = athletemodel.get_from_store()
# 从模型获得数据

form_data = cgi.FieldStorage()
#所有表单数据,并放到一个字典中

athlete_name = form_data['which_athlete'].value
#从表单数据中访问一个指定的数据

print(yate.start_response())
print(yate.include_header("Coach Yj's Timing Data"))
print(
    yate.header("Athlete: " + athlete_name + ", DOB: " +
                athletes[athlete_name].dob + "."))
print(yate.para("The top times for this athlete are:"))
print(yate.u_list(athletes[athlete_name].top3))
print(
    yate.include_footer({
        'Home': "/index.html",
        "Select anthor athlete:": "generate_list.py"
    }))
Exemplo n.º 40
0
#! /usr/bin/env python

import athletemodel
import yate
import cgitb

#cgitb.enable()

athletes = athletemodel.get_namesID_from_store()

print(yate.start_response())
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 each_athlete in sorted(athletes):
    print(yate.radio_button_id('which_athlete', each_athlete[0], each_athlete[1]))
print(yate.end_form('Select'))

print(yate.include_footer({'Home': '/index.html'}))
Exemplo n.º 41
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'}))
Exemplo n.º 42
0
import athletemodel
import glob
import yate
import cgi

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)
print(yate.start_response())
print(yate.include_header("Atheletes list"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("Please select one athlete from the list below:"))
for each in athletes:
    print(yate.radio_button("which_athlete", athletes[each].name))
print(yate.end_form())
print(yate.include_footer({"Home": "../index.html"}))

form_data = cgi.FieldStorage()
athlete_name = form_data['which_athlete'].value
Exemplo n.º 43
0
import cgi
import athletemodel
import yate
import cgitb
cgitb.enable()

athletes = athletemodel.get_from_store()

form_data = cgi.FieldStorage()
athlete_name = form_data['which_athlete'].value


print(yate.start_response())
print(yate.include_header("Coach Kelly's  time Data"))
print(yate.header("Athlete:" + athlete_name+ ",DOB:" + athletes[athlete_name].dob+"."))

print(yate.para("The top times for this athlete are:"))
print(yate.u_list(athletes[athlete_name].top3))

print(yate.include_footer({"Home" : "/index.html",
		"select another athlete":"generate_list.py"}))
Exemplo n.º 44
0
import athletemodel
import yate
import cgi #cgi library

athletes = athletemodel.get_from_store() # get the data from the model and put it into a dictionary

form_data = cgi.FieldStorage() #Grab all of the form data and put it in a dictionary
athlete_name = form_data['which_athlete'].value

print(yate.start_response())
print(yate.include_header("Coach kelly's Timing data"))
print(yate.header("Athlete: "+athlete_name+', DOB: '+athletes[athlete_name].dob))
print(yate.para("The top 3 times are: "))
print(yate.u_list(athletes[athlete_name].top3()))
print(yate.include_footer({"Home":"/index.html","Select another athlete":"generate_list.py"}))

Exemplo n.º 45
0
import cgi  # 导入cgi库
import athletemodel
import yate

athletes = athletemodel.get_from_store()

form_data = cgi.FieldStorage()  # 获取所有表单数据并放在一个字典中
athlete_name = form_data['which_athlete'.value]

print(yate.start_response())  # 总是从一个content-type行开始
print(yate.include_header("Coach Kelly's Timing Data"))  # 开始生成Web页面,提供一个合适的标题
print(
    yate.header("Athlete:" + athlete_name + ",DOB: " +
                athletes[athlete_name].dob + "."))
print(yate.para("The top times for this athlete are:"))
print(yate.u_list(athletes[athlete_name].top3()))
print(
    yate.include_footer({
        "Home": "/index.html",
        "Select another athlete": "generate_list.py"
    }))
Exemplo n.º 46
0
import MySQLdb as mdb
import cgi
import yate
from TFBS_tools import print_tfbs, print_intervall
from pybedtools import BedTool

con = mdb.connect('genome', 'rsnp', 'RSNP', 'testdb');

header_order = ['TFBS_ID','peak','de_novo_motif','organism','chr','start','stop','target_perc','p']
header = {'TFBS_ID':'TFBS','peak':'PEAK','de_novo_motif':'motif','organism':'Organism','chr':'chr','start':'start','stop':'stop','target_perc':'target%','p':'P'}

a=cgi.FieldStorage()
form_data = a.getvalue('exp')
user_file = a.getvalue('user')
mypath='/var/www/rsnpdb/DATA/BED/'+form_data+'.bed'

a = BedTool(user_file)
b = BedTool(mypath)

result = []
for line in BedTool.intersect(a,b):
	result.append(str(line).split())
print(yate.start_response())
print(yate.include_header(''))  

for line in result:
	print_intervall("'"+line[0][3:].lower()+"'",line[1],line[2])

print(yate.include_footer({""}))

Exemplo n.º 47
0
import cgi
import athletemodel
import yate

athletes = athletemodel.get_from_store()

# Here cgi module is used to access the form data coming from genrate_list.py
# which athlete data you are working with
# Web server send us the data to CGI Script(from genrate_list.py)
# Grab all the form data and put it in dictionary

form_data = cgi.FieldStorage()

# Access the named piece of data from the form's data.
athlete_name = form_data['which_athlete'].value

print(yate.start_response())

print(yate.include_header("Coach Kelly Timing Data"))

print(yate.header("Athlete: " + athlete_name + " " +
                  ', dob:' + athletes[athlete_name].dob + "."))

print(yate.para_text("The top Three times for the Athletes"))

print(yate.u_list(athletes[athlete_name].top3))

print(yate.include_footer({"Home": "/index.html",
                           "Select another athlete": "generate_list.py"}))
Exemplo n.º 48
0
#!/usr/bin/python3
import yate
import wishmodel
import get_db_path

wishes = wishmodel.get_wishes_from_store()
#时间倒序排序
wishes.sort(key=lambda x: x[5], reverse=1)
#生成页面
print(yate.start_response())
print(yate.include_header("心愿墙"))
boxes = yate.include_wishes_form(wishes)
print(yate.include_footer(boxes))
Exemplo n.º 49
0
#! /usr/local/bin/python3
#点击查看成绩的时候调用这个函数
import cgitb
cgitb.enable()

import athletemodel
import cgi
import yate

athletes = athletemodel.get_namesID_from_store()

print(yate.start_response())
print(yate.include_header("运动员的成绩"))
print(yate.start_form("generate_timing_data.py"))  #选择想要查询的运动员名字后,执行这个脚本
print(yate.para("选择你想要查询的运动员: "))

for each_athlete in athletes:
    print(
        yate.radio_button_id("which_athlete", each_athlete[0],
                             each_athlete[1]))
    #print(each_athlete[0],each_athlete[1])
print(yate.end_form("查询"))

print(yate.include_footer({"返回主页": "/index.html"}))
Exemplo n.º 50
0
#! /usr/local/bin/python3

import cgi
import athletemodel
import yate

form_data = cgi.FieldStorage()
athlete_id = form_data['which_athlete'].value
athlete = athletemodel.get_athlete_from_id(athlete_id)

print((yate.start_response()))
print((yate.include_header("NUAC's Timing Data")))    
print((yate.header("Athlete: " + athlete['Name'] + ", DOB: " + athlete['DOB'] + ".")))
print((yate.para("The top times for this athlete are:")))
print((yate.u_list(athlete['top3'])))
print((yate.para("The entire set of timing data is: " + str(athlete['data']) +
                    " (duplicates removed).")))
print((yate.include_footer({"Home": "/index.html", "Select another athlete": "generate_list.py"})))

Exemplo n.º 51
0
__author__ = 'micheng'

import yate
import athletemodel

print(yate.start_response())
print(yate.include_header("The Champion For Now"))
print(yate.para("Here is the best player among all our athletes:"))

best_record = athletemodel.get_all_timing()[0]
best_timing = best_record[1]
champion = athletemodel.get_athlete_from_id(best_record[0])

print(yate.header(champion['Name'] + ', DOB: ' + champion['DOB'] + '.'))

print(
    yate.para('The entire set of timing data is: ' + str(champion['data']) +
              ' (duplicates removed).'))

print(yate.header("The best time is: <b>" + best_timing + "</b>"))
print(
    yate.include_footer({
        "Home": "/index.html",
        "Select another athlete": "generate_list.py"
    }))
Exemplo n.º 52
0
__author__ = 'micheng'

import athletemodel
import yate
import glob
import cgitb

athletes = athletemodel.get_namesID_from_store()

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

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

print(yate.include_footer({"See the Champion": "/cgi-bin/champion.py"}))

print(yate.include_footer({"Home": "/index.html"}))
Exemplo n.º 53
0
#import chineseseg
import sql_webModel
import ehownet

##### global paratermters #######

myDB = 'final.sqlite'

# CGI parameter passing 
form_data = cgi.FieldStorage()
candidateIDList = form_data.getlist("candidateID")
candidateList = form_data.getlist("candidate")

####### controller process #############
print(yate.start_response())
print(yate.include_header("Verbose info of cal "))
# create {"C1":{'BOW':?,'Dic':?,'Rules':?,'tag':?,'segCT':?},C2:{}} 

mixInfoDic = {}
#### get eqid from candidateList 
for eqid, name in zip(candidateIDList, candidateList): 
	infoDic = sql_webModel.get_verboseInfoForCandidateByEqid(eqid,myDB)
	mixInfoDic[name] = infoDic

#print ('<h3>' + "debug ........." +'</h3>')
#print ('<p>' + str(mixInfoDic) +'</p>')

print('<h2>' + "these are BOW" +'</h2>')
for name in candidateList:
	print('<h3>' + name +'</h3>')
	print ('<p>' + str(mixInfoDic[name]['BOW']) +'</p>')
Exemplo n.º 54
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"}))
Exemplo n.º 55
0
#! /usr/bin/python3
# -*- coding: gbk -*-
import cgi
import athletemodel
import yate

athletes = athletemodel.get_from_store()

form_data = cgi.FieldStorage()
athlete_name = form_data['which_athlete'].value

print(yate.start_response())
print(yate.include_header(athlete_name+"的情报收集"))
print(yate.header("角色英文名:"+athletes[athlete_name].ename+",生日:"+athletes[athlete_name].dob+"."))
print(yate.para("登场作品:"))
print(yate.para(athletes[athlete_name].movie))
print(yate.include_footer({"返回首页":"/index.html","选择其他角色":"generate_list.py"}))
Exemplo n.º 56
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"}))
Exemplo n.º 57
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"}))
#! /usr/bin/env python
import cgitb
cgitb.enable()
import cgi
import yate
import athletemodel

athletes = athletemodel.get_from_store()

form_data = cgi.FieldStorage()
if "which_athlete" not in form_data:
    print "<H1>Error</H1>"
    print "Please choose one athlete."
athlete_name = form_data["which_athlete"].value
the_athlete = athletes[athlete_name]

print yate.start_response()
print yate.include_header("Coach Kelly's Timing Data")
print yate.header("Athlete:" + athlete_name + ", DOB:" + the_athlete.dob + ".")
print yate.para("The top times for " + athlete_name + " are:")
print yate.u_list(the_athlete.top3)
print yate.include_footer({"Home":"index.html", "Select another athlete":"generate_list.py"})
Exemplo n.º 59
0
#!/usr/bin/env python

import MySQLdb as mdb
import cgi
import yate

con = mdb.connect('genome', 'rsnp', 'RSNP', 'testdb');

form_data = cgi.FieldStorage().getvalue('id')
pos = cgi.FieldStorage().getvalue('pos')
minor = cgi.FieldStorage().getvalue('minor')
major = cgi.FieldStorage().getvalue('major')
print(yate.start_response())
print(yate.include_header(""))  
print "rSNP: "+form_data
ind={'A':0,'C':1,'G':2,'T':3}

with con:
	cur = con.cursor(mdb.cursors.DictCursor)
	cur.execute(""" SELECT RS.*,MATRIX.*,TFBS.*
				FROM RS,MATRIX,TFBS
				WHERE RS.rs_ID = %r AND
				TFBS.TFBS_ID=RS.TFBS_ID AND
				TFBS.matrix_id = MATRIX.matrix_id;""" % form_data)
	rows = cur.fetchall()
	a=rows[0]['matrix_bin'].split('\n')
	print pos+"\t"+minor+"\t"+major
	print '<table><tr>'
	for col in ['Position','A','C','G','T']:
		print "<td>%s</td>" % col
	print "</tr>"