On 20/08/11 03:58, David Lutterkort wrote:
On Fri, 2011-08-19 at 15:42 +0300, [email protected] wrote:
+#get html form for creating a new blob
+get "#{Sinatra::UrlForHelper::DEFAULT_URI_PREFIX}/buckets/:bucket/new_blob" do
+  @bucket_id = params[:bucket]
+  respond_to do |format|
+    format.html {haml :"blobs/new"}
+  end
+end

Doesn't this mean that if somebody has a blob called 'new_blob' and they
try to get the XML representation, they'll get nothing ?


yes, it does.

It would be better to do the following in the /buckets/:bucket/:blob
route:

         respond_to do
           ...
           format.html do
             templ = params[:blob] == "new_blob" ? "blobs/new" : "blobs/show"
             haml templ.to_sym
           end
         end

Even better, if we could make the special name to get at the new blob
form something less likely to collide, like
'deltacloud_get_new_html_blob_form' or some such.


I think this approach is the safest - though no matter what we call it there will always be the (theoretical) possibility that someone may want to call their blob that. If you are in agreement with the rest of this series, I can push it and then make a patch on top of that to rename the 'get new blob form' route to something like 'deltacloud_api_get_new_blob_form'. Luckily this is not documented in the REST API so shouldn't need to much explaining (and a user will only get to it by clicking on the 'new blob' button if using the html interface),

marios



David



Reply via email to