There has been a lot of discussion on HTML helpers. I think their main
shortcoming is actually that for novice web2py users it's hard to find
'the right amount' of them. Some tend to avoid them like yourself and
deprive themselves of some rapid prototyping/design options, while
some people overuse them to the point that it looks more like python
with embedded HTML rather than code. HTML helpers (as I see them, not
sure if that was Massimo's original intent) are basically 'smart
containers'. So, instead of just pushing lists/dicts to the views,
you're pushing an object that can *also* render itself. Note that this
does not prevent the designer from using the *contents* of the helpers
as regular data objects/lists and creating whatever he wants (although
it's still a bit more awkward than I'd like it to be). It just makes
it easier for the coder to make some default output without bothering
the design guy. If a design guy encounters a cryptic {{=bigbundle}} he
can always dump (instead of render) the bigbundle object to see what
goodies he has in there. Note that SOME level of cooperation is of
course needed, the goal is to make things easier, not to make
designers use xslt tables or other complex tech to get to the data in
the format they need it in. You can even have a development view which
you include everywhere which embeds into html the recursive dump of
the response dict so the designer is just a 'view source' away from
seeing how to address the data directly. Also, having the data served
in a prearranged form (think list comprehension) can greatly simplify
the presentation logic that needs to be in the view.On Jan 9, 3:28 am, Speedbird <[email protected]> wrote: > I guess I failed to deliver the hidden irony of my comments, and hope > you don't actually think that I'd *really* throw one of my devs to the > ocean nailed on a coffin. Of course there are exceptions, and I would > be the first to raise my hand if someone asks if anyone had mixed > logic and presentation at one point in their coding. > > My point is, (and I am trying to be as sincere as I can be), one > should try to think as if your code will be used and maintained by > others, from different aspects of the web development realm, I > personally work with very talented web developers/designers that I > know they'd appreciate it if I supply them with nice HTML code for > them to add their magic, of course if-statements, for-loops, and other > control structures sometimes *must* appear in your view. > > You want to know something I really have a hard time digesting? - the > so-called Helpers in web2py, look at page 50 of the manual (most > likely I cannot copy/paste parts of it here), a form object is > instantiated along with several form elements, as I said before, very > easy for the python coder (that knows html) to include all in the > controller, and in the view, just render the container variable > {{=myform}}, now think about a large application, not a blog, not a > message board, but a large company Intranet containing complex blocks > many of them containing business logic that must be applied in > different sections of the same page, your web designers will really > have a hard time mocking that up don't you think?, even if they mock- > up all forms, etc, they would end up removed from there because we > want to *pythonize* them, in this case, a change in the PRESENTATION > ordered by the business will have to be turned over to the LOGIC > programmers, the UI guy cannot do much there can he?. > > Please don't think that I am against it, not at all, in fact for > prototyping I think is incredible helpful, I am just a little > surprised that its use is so frequent in Massimo's book and many of > the "newbies" (in MVC, Web framework, etc) might think of that as a > "best practice" which IMHO it is not.. > > I am maybe 70% writing one of my former Zope apps in web2py > (incredible fast web framework and loving it), I am avoiding the HTML > and FORM helpers *like the plague*, all my forms are self-submitting > and I don't think I've written much more code than if I had created > the views within the controllers. > > What I miss is the equivalent of "has_permission(permission_name, > view_or_controller)" and/or "user.has_role(custom_role)" methods in > Zope, can anyone point me to any examples that deal with > authentication AND permissions or roles (I need to allow users to > create accounts and log in into my blog, but only to respond to > posts), can this be done using CAS?? > > Take care all > > -- speedbird --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" 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/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

