RE: [Zope] AJAX and Zope
By Zope objects I meant: You've got a page template for example, and you include such an "AJAX enabled object", basically rendering an HTML fragment, and the resulting page will include the page template code + the fragment (similar to a macro call), but will also include the needed javascript code to handle the asynchronous communication. Then another thing would be something like a PythonScript object (so you define python code and return python structures) and get it rendered as javascript to be included in somepage for processing the data returned by an asynchronous XML-RPC call to Zope within the browser. Does it make more sense now? Pascal -----Message d'origine----- De : Lennart Regebro [mailto:regebro@gmail.com] Envoyé : mercredi 24 mai 2006 14:56 À : Pascal Peregrina Cc : zope@zope.org Objet : Re: [Zope] AJAX and Zope On 5/24/06, Pascal Peregrina <Pperegrina@lastminute.com> wrote:
I was wondering if there is any plan to have built-in support (i.e. helpers, built-in Zope objects, etc) in order to support AJAX in Zope at some point.
The helpers would then be some sort of Ajax JS library. I think that at this time it makes more sense to let people choose for themselves. If one turns out to be better than the others, it will spread around the community and become a "default" standard, and then maybe it's interesting to include as a standard package, but thats a big maybe and a big if. I don't know what any built-in Zope-objects would do for Ajax. :) -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************
Have you looked at: http://zif.hill-street.net/jsonserver Jonathan ----- Original Message ----- From: "Pascal Peregrina" <Pperegrina@Lastminute.com> To: <zope@zope.org> Sent: Wednesday, May 24, 2006 9:18 AM Subject: RE: [Zope] AJAX and Zope
By Zope objects I meant:
You've got a page template for example, and you include such an "AJAX enabled object", basically rendering an HTML fragment, and the resulting page will include the page template code + the fragment (similar to a macro call), but will also include the needed javascript code to handle the asynchronous communication.
Then another thing would be something like a PythonScript object (so you define python code and return python structures) and get it rendered as javascript to be included in somepage for processing the data returned by an asynchronous XML-RPC call to Zope within the browser.
Does it make more sense now?
Pascal
-----Message d'origine----- De : Lennart Regebro [mailto:regebro@gmail.com] Envoyé : mercredi 24 mai 2006 14:56 À : Pascal Peregrina Cc : zope@zope.org Objet : Re: [Zope] AJAX and Zope
On 5/24/06, Pascal Peregrina <Pperegrina@lastminute.com> wrote:
I was wondering if there is any plan to have built-in support (i.e. helpers, built-in Zope objects, etc) in order to support AJAX in Zope at some point.
The helpers would then be some sort of Ajax JS library. I think that at this time it makes more sense to let people choose for themselves. If one turns out to be better than the others, it will spread around the community and become a "default" standard, and then maybe it's interesting to include as a standard package, but thats a big maybe and a big if.
I don't know what any built-in Zope-objects would do for Ajax. :)
-- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/
********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager.
This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com ********************************************************************** _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
--On 24. Mai 2006 14:18:34 +0100 Pascal Peregrina <Pperegrina@Lastminute.com> wrote:
By Zope objects I meant:
You've got a page template for example, and you include such an "AJAX enabled object", basically rendering an HTML fragment, and the resulting page will include the page template code + the fragment (similar to a macro call), but will also include the needed javascript code to handle the asynchronous communication.
Then another thing would be something like a PythonScript object (so you define python code and return python structures) and get it rendered as javascript to be included in somepage for processing the data returned by an asynchronous XML-RPC call to Zope within the browser.
You can do this already in Zope now in some way. Since AJAX requirements for an app are usually highly specific it does not make much sense to support a particular usecase. Zope is open and flexible enough to implement everything you need on top of it. -aj -- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: info@zopyx.com - Phone +49 - 7071 - 793376 E-Publishing, Python, Zope & Plone development, Consulting
On 5/24/06, Pascal Peregrina <Pperegrina@lastminute.com> wrote:
By Zope objects I meant:
You've got a page template for example, and you include such an "AJAX enabled object", basically rendering an HTML fragment, and the resulting page will include the page template code + the fragment (similar to a macro call), but will also include the needed javascript code to handle the asynchronous communication.
That is a macro call. There is no difference. It just that the macro includes the HTML needed to suck in the JS library you use.
Then another thing would be something like a PythonScript object (so you define python code and return python structures) and get it rendered as javascript to be included in somepage for processing the data returned by an asynchronous XML-RPC call to Zope within the browser.
Thare has been discussions and efforts to make a library where you can write python code and get Ajax out, yes. It is very non-trivial. :) -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/
Lennart Regebro wrote:
On 5/24/06, Pascal Peregrina <Pperegrina@lastminute.com> wrote:
By Zope objects I meant:
You've got a page template for example, and you include such an "AJAX enabled object", basically rendering an HTML fragment, and the resulting page will include the page template code + the fragment (similar to a macro call), but will also include the needed javascript code to handle the asynchronous communication.
That is a macro call. There is no difference. It just that the macro includes the HTML needed to suck in the JS library you use.
Then another thing would be something like a PythonScript object (so you define python code and return python structures) and get it rendered as javascript to be included in somepage for processing the data returned by an asynchronous XML-RPC call to Zope within the browser.
Thare has been discussions and efforts to make a library where you can write python code and get Ajax out, yes. It is very non-trivial. :)
You might want to look at Azax approach as well: besides the way it works (you define behaviors in XML files, that get processed by a js engine) it gathers Zope 3 help views, that let the developer define the behavior in Python I think the stuff lennart talks about is CrackAjax, but IIRC it is not really maintained and let you kinda write javascript in Python: the python code is not valid (can't be tested, etc..), but translated to valid javascript Tarek
On 5/24/06, Tarek Ziadé <tziade@nuxeo.com> wrote:
You might want to look at Azax approach as well: besides the way it works (you define behaviors in XML files, that get processed by a js engine) it gathers Zope 3 help views, that let the developer define the behavior in Python
I think the stuff lennart talks about is CrackAjax, but IIRC it is not really maintained and let you kinda write javascript in Python: the python code is not valid (can't be tested, etc..), but translated to valid javascript
I was thinking loosely about both approaches, as I'm not fully up to date about the progress in these areas. -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/
Lennart Regebro wrote:
On 5/24/06, Pascal Peregrina <Pperegrina@lastminute.com> wrote:
By Zope objects I meant:
You've got a page template for example, and you include such an "AJAX enabled object", basically rendering an HTML fragment, and the resulting page will include the page template code + the fragment (similar to a macro call), but will also include the needed javascript code to handle the asynchronous communication.
That is a macro call. There is no difference. It just that the macro includes the HTML needed to suck in the JS library you use. I have been working on a simple WSGI middleware filter that handles js library insertion pretty well, without complicated macros that assure that a javascript library gets included only once.
It works by creating a WSGI environ variable for desired includes. Individual widgets ask a utility to register their need for a particular javascript or css resource into that environ variable. After Zope is finished generating the page, the middleware inserts the appropriate <script> and/or <style> tags into <head> before delivery to the client. The current implementation works in Zope 3. I have not experimented with Zope 2 on this, but it seems that with Zope 2's new WSGI-friendliness and Five, it is likely not too far from something usable in Zope 2. The Zope 3 implementation needs zope.paste and paste.deploy. The middleware app itself should work for anything WSGI. Code (Due credit: the Zope 3 infrastructure for this borrows heavily from zc.resourcelibrary) and instructions are at http://zif.hill-street.net/headincludes Development status: "works for me". This is just a small piece of the AJAX puzzle for Zope, as I see it. -Jim Washington
Wed, 24 May 2006 10:41:18 -0400 keltezéssel Jim Washington azt írta:
After Zope is finished generating the page, the middleware inserts the appropriate <script> and/or <style> tags into <head> before delivery to the client.
The current implementation works in Zope 3. I have not experimented with Zope 2 on this, but it seems that with Zope 2's new WSGI-friendliness and Five, it is likely not too far from something usable in Zope 2. The Zope 3 implementation needs zope.paste and paste.deploy. The middleware app itself should work for anything WSGI.
Code (Due credit: the Zope 3 infrastructure for this borrows heavily from zc.resourcelibrary) and instructions are at http://zif.hill-street.net/headincludes Development status: "works for me".
Of course since this is a zope2 newsgroup, I would mention also that this solution does not work at the moment with Zope2. To port this in an effective I would wait until Zope versions 2.10 or even 2.11 to get into production. Porting this to 2.8 or 2.9 would be a bit pointless imo, but maybe I am wrong since I don't know the WSGI middleware in such details. Zc.resourcelibrary (with the zope3 tal engine needed) and the twisted publisher, once they are backported to z2, might even put things to their place so well that this starts working without any extra effort. I would separate the question of putting javascript and css resources into the page from the rest of the AJAX saga. This is quite an independent issue. I am not aware of any Z2-only solution because most of the work that I need to do with this is on Plone. Both Plone and Archetypes have good, settled, well-tested solutions to solve the resource issue. I would expect that once the above mentioned backporting is done the existing Plone solutions would move more down to the Z3 level and utilize mechanisms like zc.resourcelibrary or WSGI. To have this in production code is a question of say, few years: a bit less, more optimistically, but right now is a no-option for production code. Now I would turn to the AJAX question in general. For the client-server communication I can suggest to use jsonserver: this is backported to Zope2 by myself and at the moment we are even doing a full merge of the zope2 and zope3 products version, so it's guaranteed the code you make for zope2 with it will run seamlessly on zope3 without a need for a change. Jsonserver offers JSON-RPC which is a protocol similar to XML-RPC but with quite some nice extras. The homepage at the moment is http://www.zope.org/Members/jsonserver2 . When the z2-z3 merge is done, I will also make the examples tutorial available in a better form, too. I have to add that a lot of other frameworks use the JSON format in itself, without the RPC part, but the RPC part is such a benefitial extra that these javascript libs would also start offering the JSON-RPC option once the server and client libraries get a wider availability. The other, higher level framework that I think, when finished, will be a very potent solution, is AZAX. At the moment it is much work in progress. A usable version will be expected very soon. There is a development info site on http://azax.ree.hu with not-so-useful information but as our time allows this will be extended, so you may be interested to tune in. And of course there are quite a few other higher level, vell working solutions to choose from, some of which the previous posters have already mentioned. Pick your own choice, there is no "the" framework at the moment. In any case, expect to work with a set of framework most proper for your purposes. -- Balazs Ree
The one thing I have found about Ajax and Zope (Ajax and anything really) is that your returned scripts are typically so customized to your web page DOM and your application logic. So, as someone else posted, Zope handles everything in it's own separate objects anyway, so no need for a special server side processing system. This is just my limited experience though. I found it was just as easy to use Dojo Toolkit and my plain old DTML objects on Zope2 for my app server. You could just as easily use PT and Python scripts. Have a look at this site I did as a demo last fall. http://www.zajax.net I was first asking the same things you were. I wanted a library or some other way to handle the Ajax calls, but found it was so simple to just use Dojo and let it do asynchronous calls to Zope DTML objects. What I have is uber simple, but that's all I wanted. I can't remember if in that demo I returned javascripts or html, but I do know that with Dojo you can do either one. I built another small Ajax app later, and it does return javascripts. (very fast updates that way) On 5/24/06, Pascal Peregrina <Pperegrina@lastminute.com> wrote:
By Zope objects I meant:
You've got a page template for example, and you include such an "AJAX enabled object", basically rendering an HTML fragment, and the resulting page will include the page template code + the fragment (similar to a macro call), but will also include the needed javascript code to handle the asynchronous communication.
Then another thing would be something like a PythonScript object (so you define python code and return python structures) and get it rendered as javascript to be included in somepage for processing the data returned by an asynchronous XML-RPC call to Zope within the browser.
Does it make more sense now?
Pascal
-----Message d'origine----- De: Lennart Regebro [mailto:regebro@gmail.com] Envoyé: mercredi 24 mai 2006 14:56 Ŕ: Pascal Peregrina Cc: zope@zope.org Objet: Re: [Zope] AJAX and Zope
On 5/24/06, Pascal Peregrina <Pperegrina@lastminute.com> wrote:
I was wondering if there is any plan to have built-in support (i.e. helpers, built-in Zope objects, etc) in order to support AJAX in Zope at some point.
The helpers would then be some sort of Ajax JS library. I think that at this time it makes more sense to let people choose for themselves. If one turns out to be better than the others, it will spread around the community and become a "default" standard, and then maybe it's interesting to include as a standard package, but thats a big maybe and a big if.
I don't know what any built-in Zope-objects would do for Ajax. :)
-- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/
********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager.
This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com ********************************************************************** _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- Greg Fischer 1st Byte Solutions http://www.1stbyte.com
participants (8)
-
Andreas Jung -
Balazs Ree -
Greg Fischer -
Jim Washington -
Jonathan -
Lennart Regebro -
Pascal Peregrina -
Tarek Ziadé