On Sun, May 18, 2008 at 5:15 PM, Alexis Georges
<[EMAIL PROTECTED]> wrote:
>
> Hello,
> I am having trouble understanding how the methods of a REST controller
> are implemented, especially the new()/create() and edit()/update()
> methods.

I think you mean "how the methods work" not "how they are implemented"
because you have to give them an implementation. By the way new() is
called for GET /collection/new, create() for POST /collection, edit()
for GET /collection/resource/edit and update() for PUT
/collection/resource/edit. See also
http://routes.groovie.org/manual.html#restful-services

> new() and edit() return a form if format is 'html'; would they return
> an XML document if format were 'xml'?

It is up to you to decide what the methods should do or return. Pylons
with Routes just decides what HTTP method on which resource calls what
method.

> Now say the client POSTs an XML document to create(), how do I know
> that it is an XML document? In fact how do I know what the data format
> is?

Take a look in the HTTP Content-type header. The request.headers
object is your guy.

> I have tried to find a simple but complete example that includes an
> actual implementation (using both Pylons and Rails) of these methods,
> but the articles/tutorials only go as far as showing how the routing
> part works.

I found this: 
http://wiki.pylonshq.com/display/pylonscookbook/How+map.resource+enables+controllers+as+services

>


-- 
Lawrence, stacktrace.it - oluyede.org - neropercaso.it
"It is difficult to get a man to understand
something when his salary depends on not
understanding it" - Upton Sinclair

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
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