>
> On Nov 21, 2007, at 5:35 AM, Justin wrote:
>
>     def test(self, var):
>         id = var
>         if int(id) > 5:
>             return 'GREATER THAN'
>         else:
>             return 'LESS THAN'
>
> You'll run into trouble here if var is '' or contains non-numeric
> characters.  Your default value in the routing rule is "novar", which
> would raise a ValueError exception and ultimately a "500 Internal
> Server Error".  Since we can't trust users to always put numeric
> values, you should trap the case thus:
>
> Yeah, I know. The "novar" default was left over from passing strings
> to the page via querystring. Like I said I'm just throwing stuff at
> the framework right now to kind of "feel it out" and get a grip on how
> it handles stuff.
>
> Just to rule out the possibility that I did somthing wierd I created a
> new project, added a new controller (changed nothing, its index action
> returns 'Hello World', and just add the line to by BaseController to
> print out the class name and received almost the same result:
>
> CtestController
> TemplateController
> ErrorController
> TemplateController
> ErrorController
> TemplateController
> ErrorController
> TemplateController
> ErrorController
>

Again, print out the PATH_INFO of the requested URLs and you'll  
figure out what's being requested from your browser.

If you still don't believe me that your browser is making those  
requests, load live http headers or the like and watch what it's  
doing. =]

Also try hitting the page with a simple HTTP client (curl -O http:// 
localhost:5000/): you'll see just one request.

--
Philip Jenvey

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to