Help with beginner form using lpthw.web

P

pngrv

Hey --

I'm still learning what all of the different exceptions and errors mean. What I'd like to do is grab a bit of assistance figuring out the error I'm getting so that I can keep moving.

My python code for this particular part of the app looks like this:

class rs_request:
def GET(self):
return render.rs_request()

def POST(self):
form = web.input(name='Dood', project='Awesome', locations='1', engines='1')
request_string = 'Request: %s, %s, %s, %s' % (form.name, form.project, form.locations, form.engines)
return render.index(request_string = request_string)


My HTML:

<html>
<head>
<title>Please Use This Form To Request Resources</title>
</head>
<body>
<form action="/rs_request" method="POST">
Name: <input type="text" name="name"><br/>
Project: <input type="text" name="project"><br/>
# of Locations: <input type="text" name="locations"><br/>
# of Engines:
<select name="engines">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9+">9+</option>
</select><br/><br/>
<input type="submit"><br/><br/>
</form>
$def with (request_string)
$if request_string:
I just wanted to say <em style="color: green; font-size: 2em;">$request_string</em>.
$else:
<em>Hello</em>, world!
</body>
</html>

And seeing this error:
<type 'exceptions.SyntaxError'> at /rs_request
invalid syntax Template traceback: File 'templates/rs_request.html', line 30 </html> (rs_request.html, line 30)

Python /Library/Python/2.7/site-packages/web/template.py in compile_template, line 909
Web GET http://localhost:8080/rs_request

So, it seems to be indicating that my GET request is broken, but I don't really understand why. Can anyone help?
 
E

Emile van Sebille

On 10/15/2011 8:03 AM pngrv said...
<html>
<head>
<title>Please Use This Form To Request Resources</title>
</head>
<body>
<form action="/rs_request" method="POST">
Name:<input type="text" name="name"><br/>
Project:<input type="text" name="project"><br/>
# of Locations:<input type="text" name="locations"><br/>
# of Engines:
<select name="engines">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9+">9+</option>
</select><br/><br/>
<input type="submit">

Where do you close this tag?
<br/><br/>
</form>
$def with (request_string)
$if request_string:
I just wanted to say<em style="color: green; font-size: 2em;">$request_string</em>.
$else:
<em>Hello</em>, world!
</body>
</html>

And seeing this error:
<type 'exceptions.SyntaxError'> at /rs_request
invalid syntax Template traceback: File 'templates/rs_request.html', line 30</html> (rs_request.html, line 30)


Emile
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top