On Sat, Oct 3, 2009 at 02:47, mdipierro <mdipie...@cs.depaul.edu> wrote: > > On a second thought, Alvaro is right. > I have implemented a rating component. It works but one may have a lot > of them in one page. > It should be possible for components work both via ajax a non. > > Moreover if {{load ... }} were to be implemented as Alvaro suggests as > part of the template and run in the same environment it will be better > than creating a helper. > > I still think this would introduce a lot more complexity but I would > like to see a more detailed description of the idea and perhaps a > proof of concept.
I have a "beta" version here but it don't work completly. Yes, we should exec twice and I think it is a problem. But I think we have to 'solve' this problem server-side, don't client-side. Other idea is: web2py, when see '{{load ...}}', create a 'fake/proxy/whatever' connection to itself using same data of user's request and then gets the response, so it includes the response in the place that '{{load ...}}' was - it'll avoid AJAX but I don't think it is a great idea too. :-( > Massimo > > > On Oct 1, 4:24 pm, Álvaro Justen [Turicas] <alvarojus...@gmail.com> > wrote: >> On Wed, Sep 30, 2009 at 16:09, Massimo Di Pierro >> >> <mdipie...@cs.depaul.edu> wrote: >> > Here is a video explaining the proposal >> >> > http://vimeo.com/6836681 >> >> > Attached is a document containing the proposal, the code, and >> > requesting help modify admin to do this. >> >> > This would make it easy to build a repository of plugins similar but >> > better than Drupal, reusable, more sexy via ajax, without having to >> > learn an new syntax. >> >> > Massimo >> >> Sincerely I don't like this. >> The idea of a plugin system is very good, but I didn't like this >> implementation. >> If I have 1 application with 10 plugins so visitor's browser will do >> 11 HTTP requests (1 for app and 10 async (AJAX)) and it must have >> javascript enabled! So all plugins that we create will need that >> visitor's browser have javascript enabled (some clientes don't have by >> default or by security issues (companies disabled it, for example), >> others DON'T have support for javascript etc.) and it will overload >> our webserver (11 requests instead of 1). >> I think that a plugin should interact with web2py app, not with >> browser - so what I propose is to change gluon/some-files.py to >> implement this, not necessarily changing only web2py_ajax.html. >> One thing that I'm thinking is to have a new reserved word in template >> system, for example, in myapp/views/default/test.html: >> >> <code> >> This is a test page. >> If web2py implement a plugin system, you should see a form to post a comment: >> >> {{load 'mypap/plugin_comments/form_comment'}} >> </code> >> >> So we only need to change gluon/template.py to: >> - when it finds "{{load 'a/b/c'}}" it does: >> 1- Copy code of function 'c' (controller 'b.py', app 'a') to some_var; >> 2- Add do some_var the code: "bla = function_c()" >> 3- Add do some_var the code: 'result = parse_template"("%s", >> path=../applications/%s/views/)' % (bla, a) >> 4- Add the content of some_var to code that will be executed in >> view (that code that have a lot of 'response.write') >> 5- So no we have the result we expect. >> >> It should be useful to other things too, like create some 'modules' of >> apps (we can create modules and should not create plugins for >> optimization) and to be an easy way to embed some actions/views in >> other pages. >> >> What do you think? >> I like this feature and think it should be implemented even it is not >> by default as plugin system - but I think if we use it in plugin >> system we will be creating apps with a more unobstructive and >> optimized code (for app, for browser/javascript and mainly for web >> server). >> >> We must learn more about plugin systems (with wordpress, for example) >> before posting this as stable. -- Álvaro Justen Peta5 - Telecomunicações e Software Livre 21 3021-6001 / 9898-0141 http://www.peta5.com.br/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---