On Nov 20, 2007 12:02 PM, Justin <[EMAIL PROTECTED]> wrote:
> Thank you both for your responses. Right now, I'm just evaluating the
> framework to see if it seems like a good fit so the controller doesn't
> do much

We like troubleshooting small, simple examples. :)

>     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:

    if not var.isdigit():
        return "Third URL component must be numeric."

>     map.connect('hello/test/:var', controller='hello', action='test',
> var="novar")


> Requested url:
>
> http://localhost:5000/hello/test/10/

Does it make a difference if you omit the trailing slash?

> I also printed out the return value of each controller called and the
> error controllers are returning a 404 page each time.

You mean the error controller itself is failing to return a page?

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
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