コード例 #1
0
    def post(self):
        html.header(self)
        self.response.out.write(
            '<form action = "/add" method = "get"><input type = "submit" value = "Add Contact" class = "submit"></input></form>'
        )
        self.response.out.write(
            '<form action = "/addWeek" method = "get"><input type = "submit" value = "Add Week" class = "submit"></input></form>'
        )
        self.response.out.write(
            '<form action = "/mailingList" method = "get"><input type = "submit" value = "Mailing List" class = "submit"></input></form><br/>'
        )
        self.response.out.write(
            '<form action = "/search" method = "post"><input type="text" name="search" rows="1" class = "post-form-textarea"></input><br/><input type = "submit" value = "Search" class = "submit"></input></form><br/>'
        )
        html.weekFilter(self)
        search_query = cgi.escape(self.request.get("search"))
        name_query = search_query.title()
        contacts = datamodel.Contact.all()
        contacts.filter("firstName = ", name_query)
        for contact in contacts:
            html.listing(self, contact)

        contacts = datamodel.Contact.all()
        contacts.filter("lastName = ", name_query)
        for contact in contacts:
            html.listing(self, contact)

        contacts = datamodel.Contact.all()
        contacts.filter("email = ", search_query)
        for contact in contacts:
            html.listing(self, contact)
        html.footer(self)
コード例 #2
0
    def get(self):
        html.header(self)
        id = int(float(string.lstrip(self.request.path, "contact/")))
        contact = datamodel.Contact.get_by_id(id)
        html.contact(self, contact)
        html.addRelation(self, contact)

        self.response.out.write('<br/><div class="header">Relations</div>')
        for rel in contact.relations:
            r = datamodel.Contact.get_by_id(rel.id())
            html.contact(self, r)

        html.footer(self)
コード例 #3
0
ファイル: index.py プロジェクト: kyau/bbs-kyau_net
def main():
    maintenance = 0
    helpmsg = 0
    if maintenance:
        print('Location: /_blank.py\r\n\r')
    #if not environ.has_key('QUERY_STRING'):
    if environ['QUERY_STRING'] == '':
        query = 'main'
    else:
        query = environ['QUERY_STRING']
    html.header(str(query))
    if query == 'main':
        html.main_v2()
        helpmsg = 1
    elif query == 'enter':
        html.enter_v2()
    elif query == 'flash':
        html.flash_v2()
    elif query == 'about':
        html.about_v2()
    elif query == 'gossip':
        html.gos_v2()
    elif query == 'who':
        html.who_v2()
    elif query == 'top':
        html.top_v2()
    elif query == 'topgang':
        html.topg_v2()
    elif query == 'rules':
        html.rules_v2()
    elif query == 'realm':
        html.realm_v2()
    elif query == 'notes':
        html.notes_v2()
    elif query == 'files':
        html.files_v2()
    elif query == 'megamud':
        html.filesection('mega', 'MegaMud')
    elif query == 'majormud':
        html.filesection('mmud', 'MajorMUD')
    elif query == 'wgserv':
        html.filesection('wgserv', 'Worldgroup')
    elif query == 'aftermud':
        print('<pre>')
        with open('AFTERMUD.REL', 'r') as file:
            print(file.read())
        print('</pre>')
    else:
        html.error(404)
    html.footer(helpmsg)
    return 0
コード例 #4
0
def strategy_new(environ):
  body=read(environ)
  form=cgi.FieldStorage(fp=body, environ=environ, keep_blank_values=True)
  auth = environ['HTTP_AUTHORIZATION'].split(' ')[1]
  username, password = auth.decode('base64').split(':', 1)
  strategies.add_strategy(form.getvalue("name") ,form.getvalue("file"), username)
  return html.header('Ahoy!')+html.strat_new()+html.footer()
コード例 #5
0
def user_new(environ):
  post = path.get_post_array(environ)
  if post['test'][0]!="8":
    raise Exception('Begone!')
  u=users.User(post['username'][0])
  u.add_user(post['password'][0])
  return html.header('Ahoy!', False)+html.user_new(post['username'][0])+html.footer()
コード例 #6
0
def strats(environ):
  auth = environ['HTTP_AUTHORIZATION'].split(' ')[1]
  username, password = auth.decode('base64').split(':', 1)
  strats=strategies.get_users_strategies(username)
  response_body=html.header('Ahoy!')
  response_body+=html.strats(strats)
  response_body+=html.footer()
  return response_body
コード例 #7
0
def strats_delete(environ):
  auth = environ['HTTP_AUTHORIZATION'].split(' ')[1]
  username, password = auth.decode('base64').split(':', 1)
  label=environ['PATH_INFO'].split('/')[-1]
  strategies.delete_stategy(label, username)
  response_body=html.header('Ahoy!')
  response_body+=html.strat_delete(label)
  response_body+=html.footer()
  return response_body
コード例 #8
0
 def get(self):
     html.header(self)
     self.response.out.write(
         '<form action = "/add" method = "get"><input type = "submit" value = "Add Contact" class = "submit"></input></form>'
     )
     self.response.out.write(
         '<form action = "/addWeek" method = "get"><input type = "submit" value = "Add Week" class = "submit"></input></form>'
     )
     self.response.out.write(
         '<form action = "/mailingList" method = "get"><input type = "submit" value = "Mailing List" class = "submit"></input></form><br/>'
     )
     self.response.out.write(
         '<form action = "/search" method = "post"><input type="text" name="search" rows="1" class = "post-form-textarea"></input><br/><input type = "submit" value = "Search" class = "submit"></input></form><br/>'
     )
     html.weekFilter(self)
     contacts = datamodel.Contact.all().order("lastName")
     for contact in contacts:
         html.listing(self, contact)
     html.footer(self)
コード例 #9
0
def game_show(environ):
  response_body = html.header('Ahoy!')
  uri = environ['PATH_INFO'].split('/')
  g = games.Game(uri[3])
  response_body += html.show_game(g)
  g.play()
  response_body += '<pre>%s</pre>' % g.stdoutdata
  response_body += html.show_game(g)
  response_body += html.footer()
  return response_body
コード例 #10
0
 def get(self):
     html.header(self)
     wid = int(float(string.lstrip(self.request.path, "week/")))
     week = datamodel.Week.get_by_id(wid)
     self.response.out.write(
         '<form action = "/add" method = "get"><input type = "submit" value = "Add Contact" class = "submit"></input></form>'
     )
     self.response.out.write(
         '<form action = "/addWeek" method = "get"><input type = "submit" value = "Add Week" class = "submit"></input></form>'
     )
     self.response.out.write(
         '<form action = "/mailingList" method = "get"><input type="hidden" name="week" value="'
         + str(wid)
         + '"></input><input type = "submit" value = "Mailing List" class = "submit"></input></form><br/>'
     )
     self.response.out.write(
         '<form action = "/search" method = "post"><input type="text" name="search" rows="1" class = "post-form-textarea"></input><br/><input type = "submit" value = "Search" class = "submit"></input></form><br/>'
     )
     html.weekFilter(self)
     contacts = datamodel.Contact.all()
     contacts.filter("weeks = ", week.key())
     for contact in contacts:
         html.listing(self, contact)
     html.footer(self)
コード例 #11
0
 def get(self):
     html.header(self)
     html.weekForm(self)
     html.footer(self)
コード例 #12
0
def delete(environ):
  response_body=html.header('Ahoy!')
  response_body+=html.delete()
  response_body+=html.footer()
  return response_body
コード例 #13
0
 def get(self):
     html.header(self)
     cid = int(float(string.lstrip(self.request.path, "edit/contact/")))
     contact = datamodel.Contact.get_by_id(cid)
     html.editContact(self, contact)
     html.footer(self)
コード例 #14
0
ファイル: buildmap.py プロジェクト: ohm2013/buildmap
					mapLayers.append(identifier)
				if 'text' in component:
					identifier = mapLayer + "-points"
					mapFile += map.pointLayer(identifier, filename, sourceLayer, component['text'], component['fontSize'] if 'fontSize' in component else None)
					mapLayers.append(identifier)
	tilecacheFile += tilecache.layer(layer['title'], mapLayers, mapDir)
	htmlFile += html.layer(layer['title'], layer['title'], 'enabled' not in layer or layer['enabled'], 'hidden' in layer and layer['hidden'], layer['mergeLayer'] if 'mergeLayer' in layer else None)
	layerNames = [layer['title']]
	if 'aliases' in layer:
		layerNames += layer['aliases']
	layersDefFile += ','.join(layerNames) + '\n'
runCommands(commands)

mapFile += map.footer()
tilecacheFile += tilecache.footer()
htmlFile += html.footer()

print "Generating mapfile 'ohm.map'..."
mapStream = open('ohm.map', 'w')
mapStream.write(mapFile)
mapStream.close()

print "Generating 'tilecache.cfg'..."
tilecacheStream = open('tilecache.cfg', 'w')
tilecacheStream.write(tilecacheFile)
tilecacheStream.close()

for filename in config.mapExtraFiles:
	shutil.copy(filename, ".")

commands = []
コード例 #15
0
leviTerms = { 
            'Levi': 'Olevsky',
            'Elephant' : 'Big Gray Animal',
            'Mouse' : 'Small Gray Animal',
            'Zebra' : 'Medium Gray Animal',
            'Helen' : 'Ye'
            }
leviTermsList = leviTerms.keys()
#['Levi', 'Helen', 'Mouse', 'Zebra', 'Elephant']

def flipCard(list, dict, term):
    value = dict[term]
    list[list.index(term)] = value
    dict.pop(term)
    dict[value] = term

def flipCardWithTerm(term):
    flipCard(leviTermsList, leviTerms, term)
    
flipCardWithTerm('Levi') 


print '<center>' + html.header('cards'), \
      html.tableTop(), \
      html.oneTable(leviTermsList, leviTerms), \
      html.tableBttm(), \
      html.footer() + '</center>'
      
print queryString.value
コード例 #16
0
ファイル: main.py プロジェクト: alseambusher/OWLTagger
import config
import os
import html
from wsdl import WSDL
import json
html.header()
distance_matrix=clustering.get_distance_matrix()

html.distance_matrix(distance_matrix)

old_distance_matrix=json.dumps(distance_matrix)
if config.K_MEANS_CLUSTERING:
    clusters=clustering.get_all_clusters_k_means(distance_matrix)
else:
    clusters=clustering.get_all_clusters(distance_matrix)

html.cluster(clusters)

#parse WSDL
wsdl_object_array=[]
for service in os.listdir(config.SERVICES_FOLDER):
    wsdl_object_array.append(WSDL(config.SERVICES_FOLDER+service))

#now  calculate token weight for each of the wsdl
token_weight={}
for wsdl in wsdl_object_array:
    token_weight[wsdl.file_name]=extraction.total_token_weight(wsdl,clusters)

html.tokens(token_weight)
html.footer()
コード例 #17
0
        print html.heading(1, 'SUCCESS! Now login on the main page.')
        os.makedirs(reguser)
        shutil.copy2('homepage.py', reguser + '/homepage.py')
        shutil.copy2('quiz.html', reguser + '/quiz.html')
        shutil.copy2('flashCards.html', reguser + '/flashCards.html')
    elif reguser in curr:
        print html.heading(1, 'This username already exists.')
    elif regpw != re:
        print html.heading(1, 'The passwords do not match!')
# For when the person is trying to log in
else:
    user = qs['user'].value
    pw = qs['pw'].value
    # Makes sure the username exists and if not, prints redirection header
    if user in curr:
        # Checks if the encrypted password in CSV matches the encrypted one the user submitted
        # If so, successful login, if not, print redirection header
        if curr[user] == hashlib.sha256(pw).hexdigest():
            print html.headerWTags('Redirecting', '<meta http-equiv="refresh" content="2;url=' + user + '/homepage.py"/>')
            print html.heading(1, 'success')
            #login success stuff
        else:
            print html.headerWTags('Redirecting', '<meta http-equiv="refresh" content="2;url=index.html"/>')
            print html.heading(1, 'Incorrect password. Please try again.')
    else:
        print html.headerWTags('Redirecting', '<meta http-equiv="refresh" content="2;index.html"/>')
        print html.heading(1, 'Incorrect username. Please try again.')

print html.heading(3, 'Redirecting in 2 seconds.')
print html.footer()
コード例 #18
0
def main(environ):
  response_body = html.header('Ahoy!', False)
  response_body += html.welcome()
  response_body += html.footer()
  return response_body
コード例 #19
0
def strategy(environ):
  response_body = html.header('Ahoy!')
  response_body += html.form_new_strategy()
  response_body += html.footer()
  return response_body
コード例 #20
0
def menu(environ):
  response_body = html.header('Ahoy!')
  response_body += html.menu()
  response_body += html.footer()
  return response_body
コード例 #21
0
def user(environ):
  response_body = html.header('Ahoy!', False)
  response_body += html.form_create_new_user()
  response_body += html.footer()
  return response_body
コード例 #22
0
def game(environ):
  response_body = html.header('Ahoy!')
  response_body += html.form_create_new_game(strategies.get_strategies())
  response_body += html.footer()
  return response_body