+1 for this.

As I read the first sentence of Kevin's post, I pretty much assumed
your solution (that templates are views).  I was a little surprised
when he suggested something else.

Ed

On 7/30/06, Yves-Eric Martin <[EMAIL PROTECTED]> wrote:
>
> Thoughts from a newbie: sorry but -1 for @view, alternative way to
> introduce "view" in the TG terminology. Explanations below.
>
>
> Kevin Dangoor wrote:
> > The view for a given request is really represented by the @expose decorator.
>
> Hmmm... is it really so? Take this pretty common web development
> pattern: to prevent multiple form submission by a user reloading the
> results page, a form submits to a submission script (logic only), that
> then does a redirect to a results page (view). From my newbie
> perspective, if the decorator was called @view, then here is how I
> would have coded this on my first try:
>
>
>     def saveFoo(self, *args, **kw):
>         # Logic to save foo here...
>         # ...
>         raise turbogears.redirect('/results')
>
>     @view(template='foo.templates.results')
>     def results(self):
>         return "Thank you!"
>
>
> Of course that would not work...  But then I'd have to ask: why do I
> need the @view decorator on the saveFoo() method, since in the MVC
> sense, this method does not have a view? On the other hand, I find
> @expose much easier to grasp, since it simply says what it actually
> does: expose the method to the outside.
>
> So, even if we keep @expose for compatibility, simply calling the
> decorator @view, and in particular marketing it as "@view" in the
> documentation, would have caused me some unnecessary newbie
> frustration. So I say let's call a duck a duck: -1 for @view, +1 for
> @expose.
>
>
> Now, if we want to introduce "view" in the TG terminology, my
> understanding (again, newbie alert, please correct me if I am out to
> lunch ^^; ) is that it is the templates that represent the "V" in MVC.
> So how about renaming the "template" argument of the expose decorator
> to "view", along with the "templates" folder to "views":
>
>     @expose(view='foo.views.results')
>
> Yes, that would probably be a more involved change. But again, I think
> that @view is a bad idea. So, what do you guys think?
>
>
> Cheers,
>
> PS: looks like I am having troubles with my mail server. Posting this
> through the web interface. Sincere apologies if this becomes a dupe.
> --
> Yves-Eric
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to