>From: Ben Sizer
>Sent: Wednesday, July 09, 2008 12:20 AM
>
>Why does this URL work:
>
>    http://localhost:8080/task/?task_id=82
>
>and this one does not:
>
>    http://localhost:8080/task/82
>
> [...]
>
>The controller looks like this:
>
>class TaskController(object):
>    @expose(template="view_task")
>    def index(self, task_id=None):
>        # ...etc...

Well, this is indeed not as good documented as it should. The index method is 
an exception. CherryPy tries finding a method inside your controller which is 
named after the positional argument ("82") and, if not present, expects method 
"default" as catchall. If none of them is present it yields an 404 error.

You have two options:
1. Rename it to e.g., "show", then /task/show/82 should work.
2. Define "default" method. But now you will have to handle all imaginable 
inputs for it... Or use *kw and **kwargs as parameters and yield an 404 
yourself if they happen to be invalid.

-- Mark

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to