I would like to add that I'm primarily looking at pyramid_handler
module right now, as is recommended by akhet. But I'm having trouble
using it. As:

config.add_handler("users", "/users/{action}/{id}",
"proj.handlers.users:Users")

won't match an URL such as "/users/index" or "/users". If I remove the
"/{id}" part, accessing /users/index will raise KeyError exception.
I'm sure that I have a Users class with a method named "index" with
@action decorator. I don't know what went wrong.

Another thing is that I read it's optimal to use traversal instead.
But I couldn't find a complete example, that uses traversal to
configure view handlers in a restful manner. Akhet didn't use it
either. So maybe I should stick with pyramid_handler?

How do I handle different formats, such as /users/show/someone.jpg
and /users/show/someone.json and put the format string as an argument
of my view handler method, like in pylons?

Best regards,
He Shiming

On May 15, 4:33 pm, He Shiming <[email protected]> wrote:
> Hi,
>
> I'm trying to port some restcontroller written in pylons 1.0 to
> pyramid. And I'm having trouble understanding the view configuration
> and routes. My restcontroller is originally generated with `paster
> restcontroller`, and routed via map.resource. It's already using a
> couple of "formats", including 'html', 'json', and 'jpg' to render
> different content.
>
> I'm using the akhet template, because it looked more familiar compared
> to the pyramid default template.
>
> I'm wondering if there are any tutorials on this? Or is there a sample
> project I can consult? Thanks.
>
> Best regards,
> He Shiming

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