示例#1
0
def main():
    """ Self test this module using hardcoded data """
    # form = formMockup(id="gameParameters",
    #                   p_paramCategory="1",
    #                   paramQuestions="8",
    #                   timeLimit="2",
    #                   wager="1",
    #                   user_id="36",
    #                   function="GG",
    #                   counter="2")

    form = formMockup(id="random", user_id=36, function="GG", counter=1)
    """ valid user in db (DO NOT CHANGE: modify below)"""
    # form = formMockup(function="SUI", confirm_password="******",
    #                   first_name="Antonio", paypal_account="tonym415",
    #                   password="******", email="tonym415@gmail",
    #                   last_name="Moses", username="******")
    doFunc(form)
示例#2
0
def main():
    """ Self test this module using hardcoded data """
    # form = formMockup(id="gameParameters",
    #                   p_paramCategory="1",
    #                   paramQuestions="8",
    #                   timeLimit="2",
    #                   wager="1",
    #                   user_id="36",
    #                   function="GG",
    #                   counter="2")

    form = formMockup(id="random",
                      user_id=36,
                      function="GG",
                      counter=1)
    """ valid user in db (DO NOT CHANGE: modify below)"""
    # form = formMockup(function="SUI", confirm_password="******",
    #                   first_name="Antonio", paypal_account="tonym415",
    #                   password="******", email="tonym415@gmail",
    #                   last_name="Moses", username="******")
    doFunc(form)
#!/usr/bin/python
"""
run tutor5 logic with formMockup instead of cgi.FieldStorage()
to test: python tutor5_mockup.py > temp.html, and open temp.html
"""

from formMockup import formMockup
form = formMockup(name='Bob',
                  shoesize='Small',
                  language=['Python', 'C++', 'HTML'],
                  comment='ni, Ni, NI')

# rest same as original, less form assignment

import cgi, sys
# form = cgi.FieldStorage()            # parse form data
print("Content-type: text/html")  # plus blank line

html = """
<TITLE>tutor5.py</TITLE>
<H1>Greetings</H1>
<HR>
<H4>Your name is %(name)s</H4>
<H4>You wear rather %(shoesize)s shoes</H4>
<H4>Your current job: %(job)s</H4>
<H4>You program in %(language)s</H4>
<H4>You also said:</H4>
<P>%(comment)s</P>
<HR>"""

data = {}
示例#4
0
#!/usr/bin/python

from formMockup import formMockup
form = formMockup(name='Bob', shoesize='Small', language=['Python', 'C++', 'HTML'],
                  comment='ni, Ni, NI')
#!/usr/bin/python
"""
run tutor5 logic with formMockup instead of cgi.FieldStorage()
to test: python tutor5_mockup.py > temp.html, and open temp.html
"""

from formMockup import formMockup

form = formMockup(name="Bob", shoesize="Small", language=["Python", "C++", "HTML"], comment="ni, Ni, NI")

# rest same as original, less form assignment


import cgi, sys

# form = cgi.FieldStorage()            # parse form data
print("Content-type: text/html")  # plus blank line

html = """
<TITLE>tutor5.py</TITLE>
<H1>Greetings</H1>
<HR>
<H4>Your name is %(name)s</H4>
<H4>You wear rather %(shoesize)s shoes</H4>
<H4>Your current job: %(job)s</H4>
<H4>You program in %(language)s</H4>
<H4>You also said:</H4>
<P>%(comment)s</P>
<HR>"""

data = {}