From mymir.org at googlemail.com Sun Oct 5 03:42:41 2008 From: mymir.org at googlemail.com (Vladislav Vorobiev) Date: Sun, 5 Oct 2008 03:42:41 +0200 Subject: [Kss-devel] Kupu kss plugin | overhead Message-ID: <604c02230810041842v45fdb7bar6744e9e67a6cef6b@mail.gmail.com> Hello, i write a kupu plugin for zope (without plone). My plugin works by now and Zope startup without problems. The matter is, if I request my plugin for a first time "http://localhost/mySiteWithKupuPlugin" zope makes overhead something like follows for 3 minutes. asks: 136 total, 1 running, 135 sleeping, 0 stopped, 0 zombie Cpu0 :100.0%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu1 : 1.0%us, 0.0%sy, 0.0%ni, 98.7%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st Mem: 1035848k total, 1008016k used, 27832k free, 26100k buffers Swap: 3927884k total, 92k used, 3927792k free, 471416k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 24350 zope 20 0 81144 41m 3464 S 99 4.1 2:11.56 python2.4 My files -rw-r--r-- 1 vavvav vavvav 549 2008-10-05 02:07 configure.zcml -rw-r--r-- 1 root root 0 2008-10-05 02:07 configure.zcml~ -rw-r--r-- 1 vavvav vavvav 0 2008-10-05 01:54 __init__.py -rw-r--r-- 1 vavvav vavvav 38 2008-10-05 01:53 ksstutorial-configure.zcml -rw-r--r-- 1 vavvav vavvav 110 2008-10-05 03:11 tutorial.kss -rw-r--r-- 1 vavvav vavvav 296412 2008-10-05 02:58 tutorialplugin.js -rw-r--r-- 1 vavvav vavvav 25571 2008-10-05 03:16 tutorial.pt My tutorialplugin.js file is very big because it includes all kupu(*).js libreries. It seems to be that zope analyze all this javascript code. Are there methods to turn of the analyzing, for example outsourcing the libereries in other file? I only want to load the libraries dynamically if somebody requests kupu. Whats the standard method if I have to load big *.js static libreries? Thanks Vlad -- Best Regards Vlad Vorobiev From ree at ree.hu Sun Oct 5 08:51:45 2008 From: ree at ree.hu (Balazs Ree) Date: Sun, 5 Oct 2008 08:51:45 +0200 Subject: [Kss-devel] Kupu kss plugin | overhead References: <604c02230810041842v45fdb7bar6744e9e67a6cef6b@mail.gmail.com> Message-ID: Hi Vladislav, On Sun, 05 Oct 2008 03:42:41 +0200, Vladislav Vorobiev wrote: > Hello, i write a kupu plugin for zope (without plone). Is this code publicly available somewhere? > My plugin works by now and Zope startup without problems. The matter is, > if I request my plugin for a first time > "http://localhost/mySiteWithKupuPlugin" zope makes overhead something > like follows for 3 minutes. > > asks: 136 total, 1 running, 135 sleeping, 0 stopped, 0 zombie Cpu0 > :100.0%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, > 0.0%st Cpu1 : 1.0%us, 0.0%sy, 0.0%ni, 98.7%id, 0.0%wa, 0.0%hi, > 0.3%si, 0.0%st Mem: 1035848k total, 1008016k used, 27832k free, > 26100k buffers Swap: 3927884k total, 92k used, 3927792k free, > 471416k cached > > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 24350 > zope 20 0 81144 41m 3464 S 99 4.1 2:11.56 python2.4 > > My files > > -rw-r--r-- 1 vavvav vavvav 549 2008-10-05 02:07 configure.zcml > -rw-r--r-- 1 root root 0 2008-10-05 02:07 configure.zcml~ > -rw-r--r-- 1 vavvav vavvav 0 2008-10-05 01:54 __init__.py > -rw-r--r-- 1 vavvav vavvav 38 2008-10-05 01:53 > ksstutorial-configure.zcml -rw-r--r-- 1 vavvav vavvav 110 2008-10-05 > 03:11 tutorial.kss -rw-r--r-- 1 vavvav vavvav 296412 2008-10-05 02:58 > tutorialplugin.js -rw-r--r-- 1 vavvav vavvav 25571 2008-10-05 03:16 > tutorial.pt > > My tutorialplugin.js file is very big because it includes all kupu(*).js > libreries. > It seems to be that zope analyze all this javascript code. Are there > methods to turn of the analyzing, for example outsourcing the libereries > in other file? I don't understand this. I'm not aware of zope analizing any js code. Can you please provide some more details? > I only want to load the libraries dynamically if somebody > requests kupu. Whats the standard method if I have to load big *.js > static libreries? There is no standard method. Most js library provide this, in various different ways. I myself, wrote an on-demand js loader, that works with kss (it uses the RequestManager for the actual request). It works on all the browsers I tried on. Basically, it accepts a set of javascript resources to load. Loading is done in parallel, with the limitation of maximal requests and timeout handling provided by kss natively. When these are all loaded and evaluated, it calls the specified callback where you can continue execution. If the resources are already present, or have been included in the static headers, they are not loaded again. For loading kss components (like, plugins) this may not work very well: first it could actually make page load slower because the resources loaded on demand are acquired much later during the page load, than in the static way. Second, kss should be able to freeze its engine until these resources are loaded and resume processing later from the callback; this is currently not supported in the way that would be necessary for this use. However it can be a viable solution for loading thirdparty javascript code like in your case. This is what I used it for: loading the jsMath library, that is pretty big, from a kss action that needs it. If the code is there the action executes immediately, if not, the resource is loaded and the action continues after it became available. In my use case delay caused by the load was no problem either, for the usage. The code that does this is part of the kss.plugin.jsmath: please feel free to copypaste it to your own code and experiment with it. In case more people find it useful, it can go to a component on its own. http://bazaar.launchpad.net/~kissbooth/kss.plugin.jsmath/trunk/annotate/21?file_id=kss_jsmath.js-20071127201149-79dx2pzwy2ftq08k-32 Best wishes, -- Balazs Ree From mymir.org at googlemail.com Sun Oct 5 15:26:49 2008 From: mymir.org at googlemail.com (Vladislav Vorobiev) Date: Sun, 5 Oct 2008 15:26:49 +0200 Subject: [Kss-devel] Kupu kss plugin | overhead In-Reply-To: References: <604c02230810041842v45fdb7bar6744e9e67a6cef6b@mail.gmail.com> Message-ID: <604c02230810050626n6372cae9hb53aba12f49aa290@mail.gmail.com> Hello Balazs, > Is this code publicly available somewhere? Now the source code http://dev.kss.static.mymir.org/ and working example http://mymir.ru/kssplugintutorial And there are two python scripts. for return of kupuMacros and Save Form. returnKupuMacros =========== request = context.REQUEST from kss.core.ttwapi import ( startKSSCommands, getKSSCommandSet, renderKSSCommands ) startKSSCommands(context, request) # boilerplate con=context.kupuMacros() core=getKSSCommandSet('core').replaceInnerHTML('#mybody', con) return renderKSSCommands() > I don't understand this. I'm not aware of zope analizing any js code. Can > you please provide some more details? But it seems to be. If I put in tutorialplugin.js only something like this alert('blja'); it make no overhead by first start. You can download and try it youself. > There is no standard method. Most js library provide this, in various > different ways. > > I myself, wrote an on-demand js loader, that works with kss (it uses the > RequestManager for the actual request). It works on all the browsers I > tried on. Basically, it accepts a set of javascript resources to load. > Loading is done in parallel, with the limitation of maximal requests > and timeout handling provided by kss natively. > When these are all loaded and evaluated, it calls the specified callback > where you can continue execution. If the resources are already present, > or have been included in the static headers, they are not loaded again. > > For loading kss components (like, plugins) this may not work very well: > first it could actually make page load slower because the resources > loaded on demand are acquired much later during the page load, than in > the static way. Second, kss should be able to freeze its engine until > these resources are loaded and resume processing later from the callback; > this is currently not supported in the way that would be necessary > for this use. > > However it can be a viable solution for loading thirdparty javascript > code like in your case. This is what I used it for: loading the jsMath > library, that is pretty big, from a kss action that needs it. > If the code is there the action executes immediately, if not, the > resource is loaded and the action continues after it became available. > In my use case delay caused by the load was no problem either, for the usage. > > The code that does this is part of the kss.plugin.jsmath: please feel > free to copypaste it to your own code and experiment with it. In case > more people find it useful, it can go to a component on its own. > > http://bazaar.launchpad.net/~kissbooth/kss.plugin.jsmath/trunk/annotate/21?file_id=kss_jsmath.js-20071127201149-79dx2pzwy2ftq08k-32 > Thanks, I try it next time of course :-). -- Best Regards Vlad Vorobiev http://mymir.ru/ From jc at upfrontsystems.co.za Sat Oct 11 13:14:20 2008 From: jc at upfrontsystems.co.za (JC Brand) Date: Sat, 11 Oct 2008 13:14:20 +0200 Subject: [Kss-devel] Rendering browser view template macros with macroContent Message-ID: <48F08A8C.9080401@upfrontsystems.co.za> Hi All, Can someone please tell me if there is a way to render macros for a browser view template, i.e an instance of SimpleViewClass? I tried to use macroContent in plone/app/kss/plonekssview.py but ran into some problems. I'm using plone.app.kss-1.4.3-py2.4.egg The error I get is: > Module plone.app.kss.plonekssview, line 35, in macroContent > RuntimeError: Macro not found Upon closer inspection through a pdb trace: > (Pdb) l > 24 jointpath = '/'.join(path[:-2]).encode('ascii') > 25 macroobj = self.context.restrictedTraverse(jointpath) > 26 import pdb; pdb.set_trace() > 27 -> the_macro = macroobj.macros[path[-1]] > (Pdb) p macroobj > > (Pdb) p macroobj.macros > *** AttributeError: ] So the SimpleViewClass instance does not have a macros attributes, but after some investigation I saw that I could access the macros through the index attribute as follows: > (Pdb) macroobj.index.macros.keys() > ['podcast_item'] So, in trying to understand what macroobj.index is, I do the following: > (Pdb) p macroobj.index > > (Pdb) p macroobj.index.aq_inner > Which didn't really explain it to me. Since realising this, I've modified macroContent as follows: > try: > the_macro = macroobj.macros[path[-1]] > except AttributeError: > # XXX: My customization, the only way I could get macros > # of browser templates to render. - JC Brand > the_macro = macroobj.index.macros[path[-1]] > except IndexError: > raise RuntimeError, 'Macro not found' and macroContent now renders macros in my browser view templates. But at the moment, I still don't really understand what the index attribute points to... it looks to me like a template object of the type you get with skins templates, but I'm not sure. Also, I don't know if there is a better and more elegant way of doing this, without having to hack macroContent. Any comments and help welcome. Thanks a lot JC From hedleyroos at gmail.com Sat Oct 11 13:35:53 2008 From: hedleyroos at gmail.com (Hedley Roos) Date: Sat, 11 Oct 2008 13:35:53 +0200 Subject: [Kss-devel] Rendering browser view template macros with macroContent In-Reply-To: <48F08A8C.9080401@upfrontsystems.co.za> References: <48F08A8C.9080401@upfrontsystems.co.za> Message-ID: <776caf8b0810110435x16085c64mb5d774758b0670e7@mail.gmail.com> In zope/app/pagetemplate/simpleviewclass.py you'll see 'index' is an instance of ViewPageTemplateFile from zope.app.pagetemplate.viewpagetemplatefile. macroContent needs work. So far I have my own code that can render macros in viewlets and portlets, and now you have code that can render macros in views. We should discuss the way forward with Balazs and Godefroid. You don't have to hack macroContent. You should have a "class KssView(Implicit, PloneKSSView)" declaration somewhere. Just subclass PloneKSSView, override the macroContent method and use that class as a mix-in instead of PloneKSSView. Hedley From jc at upfrontsystems.co.za Sat Oct 11 14:15:59 2008 From: jc at upfrontsystems.co.za (JC Brand) Date: Sat, 11 Oct 2008 14:15:59 +0200 Subject: [Kss-devel] Rendering browser view template macros with macroContent In-Reply-To: <776caf8b0810110435x16085c64mb5d774758b0670e7@mail.gmail.com> References: <48F08A8C.9080401@upfrontsystems.co.za> <776caf8b0810110435x16085c64mb5d774758b0670e7@mail.gmail.com> Message-ID: <48F098FF.2020305@upfrontsystems.co.za> Hedley Roos wrote: > In zope/app/pagetemplate/simpleviewclass.py you'll see 'index' is an > instance of ViewPageTemplateFile from > zope.app.pagetemplate.viewpagetemplatefile. I see thanks. > macroContent needs work. So far I have my own code that can render > macros in viewlets and portlets, and now you have code that can render > macros in views. > > We should discuss the way forward with Balazs and Godefroid. Agreed, I think it would be great to have a one size fits all approach. > You don't have to hack macroContent. You should have a "class > KssView(Implicit, PloneKSSView)" declaration somewhere. Just subclass > PloneKSSView, override the macroContent method and use that class as a > mix-in instead of PloneKSSView. Will do, so far I've been overriding it in my KssView class. Cheers From mymir.org at googlemail.com Sat Oct 18 15:05:20 2008 From: mymir.org at googlemail.com (Vladislav Vorobiev) Date: Sat, 18 Oct 2008 15:05:20 +0200 Subject: [Kss-devel] how to access absoute path with kss Message-ID: <604c02230810180605l1b6aa4f6rb753ed6917481295@mail.gmail.com> Hi, how to access absolute url with kss? For kss request seems to be equal whatever i write. Example action-server: Members/bla; kss request. Http://mydomain/mypath/Members/bla if I write action-server: /Members/bla; kss requests Http://mydomain/mypath//Members/bla ~~~~~~~//~~~~~~~ sometimes I need to access absolute path. How I can do it? The same problem I have with cachability modul Vlad -- Best Regards Vlad Vorobiev http://mymir.ru/ From ree at ree.hu Sun Oct 19 10:02:14 2008 From: ree at ree.hu (Balazs Ree) Date: Sun, 19 Oct 2008 10:02:14 +0200 Subject: [Kss-devel] how to access absoute path with kss References: <604c02230810180605l1b6aa4f6rb753ed6917481295@mail.gmail.com> Message-ID: On Sat, 18 Oct 2008 15:05:20 +0200, Vladislav Vorobiev wrote: > Hi, > > how to access absolute url with kss? > > For kss request seems to be equal whatever i write. > > Example > > action-server: Members/bla; > kss request. > Http://mydomain/mypath/Members/bla > > if I write > > action-server: /Members/bla; > kss requests > Http://mydomain/mypath//Members/bla > ~~~~~~~//~~~~~~~ > sometimes I need to access absolute path. How I can do it? The same > problem I have with cachability modul This should do it: action-server: mymethod url("http://foo.bar/whatever/method") However this should work too: action-server: mymethod url("/whatever/method") If the latter one does not work, please submit a bugreport to kssproject.org bug tracker. -- Balazs Ree From jonb at onenw.org Tue Oct 21 02:30:57 2008 From: jonb at onenw.org (Jon Baldivieso) Date: Mon, 20 Oct 2008 17:30:57 -0700 Subject: [Kss-devel] Browser history and KSS Message-ID: <1E2AE426-0B68-4634-A9E7-B4B19A26FD83@onenw.org> Has anyone integrated browser history manipulation support into a KSS plugin? I've read about efforts in that direction [1] from last year, but it's not clear that that ever got finished. Just to be clear, I'm looking for a KSS plugin that allows one to rewrite the browser's url and history so that one may use the "back" button to get to an Ajax- manipulated page's previous state, as in GMail and others. Does anyone know of examples of this? Thanks! Jon [1] - http://codespeak.net/pipermail/kss-devel/2007-October/000261.html ___________________________ Jon Baldivieso 503.222.5064 ONE/Northwest Portland Office New tools and strategies for engaging people in protecting the environment -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/kss-devel/attachments/20081020/c364dd10/attachment.htm From ree at ree.hu Tue Oct 21 06:26:41 2008 From: ree at ree.hu (=?iso-8859-1?b?UmXpIEJhbOF6cw==?=) Date: Tue, 21 Oct 2008 06:26:41 +0200 Subject: [Kss-devel] Browser history and KSS References: <1E2AE426-0B68-4634-A9E7-B4B19A26FD83@onenw.org> Message-ID: Mon, 20 Oct 2008 17:30:57 -0700 keltez?ssel Jon Baldivieso azt ?rta: > Has anyone integrated browser history manipulation support into a KSS > plugin? I've read about efforts in that direction [1] from last year, > but it's not clear that that ever got finished. Just to be clear, I'm > looking for a KSS plugin that allows one to rewrite the browser's url > and history so that one may use the "back" button to get to an Ajax- > manipulated page's previous state, as in GMail and others. Does anyone > know of examples of this? No, it has not been done and I am not aware of any progress made since the last time we discussed it. But clearly, it is feasible to integrate such existing library by means of a plugin. And it's a Very Desired Feature. Best wishes, -- Re? Bal?zs From s.hildebrandt at zestsoftware.nl Tue Oct 21 17:06:50 2008 From: s.hildebrandt at zestsoftware.nl (Simon Hildebrandt) Date: Tue, 21 Oct 2008 17:06:50 +0200 Subject: [Kss-devel] KSS blur action Message-ID: <200810211706.50159.s.hildebrandt@zestsoftware.nl> I noticed that there's a KSS client action for focus, but not blur - is there a reason for that? I'd like to use it for one of our Plone products and I'm happy to write it - just wondering if it's missing for a reason. :) -- Simon Hildebrandt Web Developer @ Zest Software From gotcha at bubblenet.be Wed Oct 22 13:05:46 2008 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Wed, 22 Oct 2008 13:05:46 +0200 Subject: [Kss-devel] KSS blur action In-Reply-To: <200810211706.50159.s.hildebrandt@zestsoftware.nl> References: <200810211706.50159.s.hildebrandt@zestsoftware.nl> Message-ID: <48FF090A.4090903@bubblenet.be> Simon Hildebrandt wrote: > I noticed that there's a KSS client action for focus, but not blur - is there > a reason for that? > I'd like to use it for one of our Plone products and I'm happy to write it - > just wondering if it's missing for a reason. :) > No reason, just distraction, -- Godefroid Chapelle (aka __gotcha) http://bubblenet.be