[Zope3-dev] No redirect!

Steve Alexander steve@cat-box.net
Mon, 28 Apr 2003 14:57:21 +0200


> On Mon, 28 Apr 2003 12:53:03 +0200, Steve Alexander wrote:

Actually, Tres wrote the parts that are preceded by >>>


> Then, that's a different question: Should views allways be the same for
> the same url? I don't think so! Same URL mean same content, not same
> view! 

The common pattern in Zope 3 is

   http://server.tld:port/folder1/folder2/content/view

The exception to this is where you are looking at the default view

   http://server.tld:port/folder1/folder2/content

This is equivalent to

   http://server.tld:port/folder1/folder2/content/defaultView

The default view name for most things is 'index.html', but you can 
change this for a particular type if you need to.

(Note that I am not discussing different skins here. That's a separate 
issue.)


> For Example:
> If I view a mail-message, I view it under /some/path/mail, 

If 'some' and 'path' are containers, and 'mail' is your mail message 
content object, then you get the default view at /some/path/mail


> but if I
> chose somewhere a short view without heades, under this url, I will see
> a short message, with now headers, but if I set a full view, I will see
> under the same url a full message view with all headers.

How do you choose these views?


> I think here we have to PoV:
> - I connect a URL to a contend
> - You connect a URL to a view
> 
> I don't now which is the better way!

I URL typically points to the view on some content.

This is the default way traversal works in Zope 3. Zope 3 is flexible 
enough to support different traversal mechanisms, and different policies 
for choosing the view for a particular request.

Provided you have a consistent and well worked-out policy, you should be 
able to implement this for your content-types if you need to.


>>>path end up breaking the browser's back button, as well as exposing
>>>non-bookmarkable URLs.
> 
> Sorry, but I don't see, why this should happen!

Let's say I go to the page

   /foo/bar/baz

and fill in the self-posting form there, and then submit the form with a 
POST. The form handling code redirects (using a 303) to

   /foo/bar/spoo

I bookmark this page. This works, as I can go back to /foo/bar/spoo and 
see the page I expect.


Now, let's say I go to the page

  /foo/bar/baz

and fill in the form there, and then submit the form with a POST.
The form handling code returns the 'spoo' view on the content at /foo/bar.

I bookmark the page.

So, I've bookmarked /foo/bar/baz, but while I expected to have 
bookmarked the content 'spoo', I have really bookmarked the original 
form 'baz'.


>>>The spec also blesses the frequent-but-noncompliant
>>>current usage of 302 response codes
>
> If the RFC do this, I even don't like it! :-( Sorry! If a browser
> connects to a url, in my point of view, it should get an correct
> answer, not a "look there"!

Why?


> By the way: I got a solution for my problem (thanks to Theuni for
> schowing me, where I was wrong!) , using somthing like:
> 
> view = getView(self.context, 'myView', self.reqeust)
> return view()

If myView contains something like a self-posting form, then this code 
will render a page that will not work properly. It will not be honouring 
the expectation of the myView page that the URL of the request is the 
URL to get to the page.

Many pages in Zope 3 have this expectation. Redirecting with a 303 is 
much better than returning the contents of a different view.

--
Steve Alexander