> >>> I've realised, widgets have to work extremely hard to include the js/css > >>> links, quite disproportional to the benefits of this. I wonder, is it > >>> enough to just include each link right next to the first widget that > >>> needs it? That could be implemented much more easily. > >> AFAIK links must be included in the <head> so that will probably don't > work. > >> > >> FYI, I've just rewritten the alternative method for including resources > >> in TW, the one that used lxml and allows widgets to be imported, > >> instantiated and even declared in the template and their js/css links > >> are included. > >> > >> The new approach doesn't require lxml at all since it uses simple > >> regular expression substitution, it's so simple I'm afraid I must be > >> missing something big that will ruin my party. :) > >> > >> So, unless there's a good reason not to use this method, which makes > >> setting up and using TW *way easier*, I'll probably make it the default > >> and deprecate the old one. > >> > >> More details here: > >> > http://groups.google.com/group/toscawidgets-discuss/browse_thread/thread/2e0288223bbbdf45 > > > > > > Alberto, this is really great! Very much how things feel right to me: > > don't mess with widget instantiation in the controller, only return > > data that will be used in the template. If the template uses a widget, > > that's fine but the controller doesn't need to know about it. If your > > new method does that (it seems to me it does) then that's really good > > news. I wouldn't need to return widget instances in the controller, > > right? > > Yeah, that's right, you could import the wigget directly in the > template. Unless, of course, it's a form instance which you need to use > to validate input with the validate() decorator. > > However, this isn't implemented for TG1 yet, only TG2/pylons/wsgi-apps. > I'll see if I can implement that soon.
Thanks for the clarification Alberto! Daniel --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---

