def tempconvert(): "post input for temperature" temptype = request.form['temptype'] temp = float(request.form['temp']) if temptype == 'C': txt = render([ html.doctype('html'), html.html(lang='en')( html.head( html.title('celcius to farenheit') ), html.body( str(C2F(temp)) ) ) ]) elif temptype == 'F': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('farenheit to celcius') ), html.body( str(F2C(temp)) ) ) ]) else: txt = 'Not valid input' return txt
def weightconvert(): "post input for weight" masstype = request.form['masstype'] weight = float(request.form['weight']) if masstype == 'kg': txt = render([ html.doctype('html'), html.html(lang='en')( html.head( html.title('kilograms -> lbs') ), html.body( str(k2p(weight)) ) ) ]) elif masstype == 'lb': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('lbs -> kilograms') ), html.body( str(p2k(weight)) ) ) ]) else: txt = 'not valid input' return txt
def liquidconvert(): "post input for liquid" liquidtype = request.form['liquidtype'] liquid = float(request.form['liquid']) if liquidtype == 'L': txt = render([ html.doctype('html'), html.html(lang='en')( html.head( html.title('liters -> gallons') ), html.body( str(l2g(liquid)) ) ) ]) elif liquidtype == 'G': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('gallons -> liters') ), html.body( str(g2l(liquid)) ) ) ]) elif liquidtype == 'l': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('liters -> ounces') ), html.body( str(l2o(liquid)) ) ) ]) elif liquidtype == 'o': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('ounces -> liters') ), html.body( str(o2l(liquid)) ) ) ]) else: txt = 'not valid input' return txt
def distanceconvert(): "post input for distance" distancetype = request.form['distancetype'] distanceamount = float(request.form['distanceamount']) if distancetype == 'm': txt = render([ html.doctype('html'), html.html(lang='en')( html.head( html.title('meters -> feet') ), html.body( str(M2F(distanceamount)) ) ) ]) elif distancetype == 'ft': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('feet -> meters') ), html.body( str(F2M(distanceamount)) ) ) ]) elif distancetype == 'KM': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('kilometers -> miles') ), html.body( str(K2M(distanceamount)) ) ) ]) elif distancetype == 'Miles': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('miles -> kilometers') ), html.body( str(M2K(distanceamount)) ) ) ]) else: txt = 'Not valid input' return txt
def head(): return html.head( html.meta(charset='utf-8'), html.newline(), # Always force latest IE rendering engine (even in intranet) & Chrome Frame # Remove this if you use the .htaccess html.meta(http_equiv='X-UA-Compatible', content='IE=edge,chrome=1'), html.newline(), html.join(html.title(html.block('title'))), html.newline(), meta_description(), meta_author(), html.newline(), # Mobile viewport optimized: j.mp/bplateviewport html.meta(name='viewport', content='width=device-width, initial-scale=1.0'), html.newline(), # Place favicon.ico & apple-touch-icon.png in the root of your domain and delete these references html.link(rel='shortcut icon', href=static('favicon.ico')), html.link(rel='apple-touch-icon', href=static('apple-touch-icon.png')), html.newline(), # CSS : implied media="all" html.link(rel='stylesheet', href=static('css/style.css')), # Uncomment if you are specifically targeting less enabled mobile browsers html.link(rel='stylesheet', media='handheld', href=static('css/handheld.css')), html.newline(), # All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects html.script(src=static('js/libs/modernizr-1.6.min.js'))(), )
def test_nested_indentating(): elements = [ html.doctype('html'), html.html(lang='en', class_='no-js')(html.head(html.title('Hello')), html.body(html.comment(' Body starts here '), html.p('Hello World!'))) ] assert render(elements) == """<!doctype html>
def site_root(): return [ html.doctype('html'), html.html( html.head( html.title( g.blocks['title'] ) ), html.body( g.blocks['body'] ) ) ]
def test_nested_indentating(): elements = [ html.doctype('html'), html.html(lang='en', class_='no-js')( html.head( html.title('Hello') ), html.body( html.comment(' Body starts here '), html.p('Hello World!') ) ) ] assert render(elements) == """<!doctype html>
def addserverpost(): "post input for server total" servers = request.form['servers'] txt = render([ html.doctype('html'), html.html(lang='en')( html.head( html.title('Scalelab Server Calculator 5000') ), html.body( "%s Dell R620 node(s) with cabling, 2 x 10gbe ports (20GbE in/out) will cost $%s USD" \ % (servers,addserver(servers)) ) ) ]) return txt
def head(): return html.head( html.meta(charset='utf-8'), html.newline(), # Always force latest IE rendering engine (even in intranet) & Chrome Frame # Remove this if you use the .htaccess html.meta(http_equiv='X-UA-Compatible', content='IE=edge,chrome=1'), html.newline(), html.join( html.title( html.block('title') ) ), html.newline(), meta_description(), meta_author(), html.newline(), # Mobile viewport optimized: j.mp/bplateviewport html.meta(name='viewport', content='width=device-width, initial-scale=1.0'), html.newline(), # Place favicon.ico & apple-touch-icon.png in the root of your domain and delete these references html.link(rel='shortcut icon', href=static('favicon.ico')), html.link(rel='apple-touch-icon', href=static('apple-touch-icon.png')), html.newline(), # CSS : implied media="all" html.link(rel='stylesheet', href=static('css/style.css')), # Uncomment if you are specifically targeting less enabled mobile browsers html.link(rel='stylesheet', media='handheld', href=static('css/handheld.css')), html.newline(), # All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects html.script(src=static('js/libs/modernizr-1.6.min.js'))(), )
def site_root(): return html.title( html.block('title')( 'Default Title' ) )
def site_root(): return html.title(html.block('title')('Default Title'))
def site_root(): return [ html.doctype('html'), html.html(html.head(html.title(g.blocks['title'])), html.body(g.blocks['body'])) ]
def currencyconvert(): "post input for currency" currencytype = request.form['currencytype'] currencyamount = float(request.form['currencyamount']) if currencytype == 'USD': txt = render([ html.doctype('html'), html.html(lang='en')( html.head( html.title('USD -> CZK') ), html.body( str(usdtoczk(currencyamount)) ) ) ]) elif currencytype == 'CZK': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('CZK -> USD') ), html.body( str(czktousd(currencyamount)) ) ) ]) elif currencytype == 'HRK': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('HRK -> USD') ), html.body( str(hrktousd(currencyamount)) ) ) ]) elif currencytype == 'USD-H': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('USD -> HRK') ), html.body( str(usdtohrk(currencyamount)) ) ) ]) elif currencytype == 'USD-E': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('USD -> EU') ), html.body( str(usdtoeu(currencyamount)) ) ) ]) elif currencytype == 'E-USD': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('EU -> USD') ), html.body( str(eutousd(currencyamount)) ) ) ]) elif currencytype == 'CZK-E': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('CZK -> EU') ), html.body( str(czktoeu(currencyamount)) ) ) ]) elif currencytype == 'E-CZK': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('EU -> CZK') ), html.body( str(eutoczk(currencyamount)) ) ) ]) elif currencytype == 'B-USD': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('BAHT -> USD') ), html.body( str(bhtousd(currencyamount)) ) ) ]) elif currencytype == 'USD-B': txt = render ([ html.doctype('html'), html.html(lang='en')( html.head( html.title('BAHT -> USD') ), html.body( str(usdtobh(currencyamount)) ) ) ]) else: txt = 'not valid input' return txt