On Thu, Jun 12, 2008 at 10:05 AM, rcs_comp <[EMAIL PROTECTED]> wrote:
> On Jun 11, 4:10 pm, Karlo Lozovina <[EMAIL PROTECTED]> wrote:
>> What's the practical difference between controller based approach and
>> views based one? Eg. Django views, and controllers in Pylons? It
>> doesn't seem that much different, so why not make all controller
>> actions regular functions, instead of class methods? What's the gain
>> in this controller approach, if any? :)
>>
>> Thanks...
>
> I differ a bit from the opinions above.  I like to think of a web
> request as asking "show me something."  Therefore, IMO, it makes sense
> to map a web request to a "view".  The view (a Python class) then
> knows how to use actions (a Python class) to "do something", the
> actions know how to use the model to get work done.  The view then
> renders a response in an appropriate format (HTML, JSON, etc.) using
> any helpers necessary (i.e. "templates").  The view does not have to
> render using a template though.
>
> I had a diagram of this at one point, but can't get the darn thing to
> open right now.  If anyone is interested in seeing a diagram let me
> know and I will try to get it working and post one.

What you are describing is closer to the Rails philosophy.  They're
big on pushing stuff into models, even validation.  I've done it that
way, and that works too.

I think of it like a pie.  You can slice the pie in many ways.  Slice
it however you like.

That's one thing I like about Pylons.  It does make you use a class
with methods, but it doesn't force you too much beyond that.  If you
want to do something strange like put all your logic in models and
then use string interpolation within your controllers you can.
Whatever floats your boat ;)

Happy Hacking!
-jj

-- 
I, for one, welcome our new Facebook overlords!
http://jjinux.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
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