[Zope3-dev] DISCUSS: Correct sequence for PUT
Jim Fulton
jim@zope.com
Wed, 19 Feb 2003 18:05:54 -0500
Paul Everitt wrote:
>
...
> 2) I'm not sure Zope 3 is doing the PUT correctly. I did a PUT of a new
> resource, and RFC 2616 (HTTP/1.1) Section 9.6 says that a status code of
> 201 should be returned. Also, the server should return a Location:
> header with the URI of the newly created resource.
>
> Perhaps I'm reading 9.6 incorrectly?
Maybe, but I probably just missed these points. This should be easy enough to fix.
Would you mind submitting a collector entry.
> 3) Finally, I gentle plea for a feature. In Moztop (and in the
> Rotterdam skin), I'd like to support Undo from the client, without
> visiting a page. That is, I'd like the most recent transaction to be
> undo-able simply by performing a gesture (click on an Undo button, for
> instance).
Well, we definately don't want that, as the most recent transaction might not be what
you think it is.
> To avoid sending the user to a page and making them select a transaction
> to undo, I propose that Zope return transaction ids as part of the
> response. This could be in an HTTP response header. Or, for things
> like PUT, we could use the response body (which we're not using right now).
This idea has merit. I'm not sure how to plumb it cleanly.
> Finally,
That's your second finally.
> I'd like some advice on how to handle the sequence for creating
> richer objects. Let's say I want to create a Smart Image without
> filling in an HTML form. I want to create it using HTTP/DAV verbs.
I don't think DAV is a very good fit for this, but ...
> To make this hard, presume two constraints:
>
...
> 1) HEAD to see if it exists.
>
> 2) PUT to create it, sending as the request body some XML for
> construction. (I could do a PUT and then a PROPPATCH, but after the PUT
> it is alread constructed, so I defeat the constructor.)
>
> 3) HEAD, just in case the server thinks the URI is different. :^)
>
> 4) PUT to actually send the body.
This should be possible. You'd define a named IFileFactory adapter
with the suffix as the view name. This factory could parse the body to get
the initial parameters and create the object. The object would then
have a IWriteFile adapter to handle putting thye body.
Jim
--
Jim Fulton mailto:jim@zope.com Python Powered!
CTO (888) 344-4332 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org