From ree at ree.hu Sun Nov 4 21:11:44 2007 From: ree at ree.hu (Balazs Ree) Date: Sun, 4 Nov 2007 21:11:44 +0100 Subject: [Kss-devel] launchpad setup for kissbooth Message-ID: Kissbooth is now on Launchpad. http://launchpad.net/kissbooth The launchpad team has kindly finished the setup of our registration for the "kissbooth" project as we requested. "Kissbooth" will play a role for kss as does the collective for Plone: it will enable the community development of kss plugins here, and experimental extensions for the kss core as well. Access is granted to a wide developer community. We already started to use it after the plone.app.kss sprint in Naples, ... and now we have in Launchpad: - a super-project "kissbooth" - a team "kissbooth" Remember, a team and a project are separate entities in Launchpad. You want to use both the team and the project group to share your code with the community. If you want to register your project as part of "kissbooth", you need to - register an account on Launchpad, and sign up to be a member of the team "kissbooth". We will approve you soon. - register your project on Launchpad with the name you prefer (we suggest the dotted import name of the python component, and in case of general purpose kss plugins, you can also use the namespace kss.plugin.yourplugin) - make this project as part of the "kissbooth" project group, and - (optionally) make the Owner of the project the "kissbooth" team. This will make sure that all kissbooth members have access to the project in the future. - Then: go ahead defining your project details, and create branches, blueprints as you wish... You can use the launchpad servers to store bzr branches for your project as well. We encourage the use of the Bazaaz repository and use Launchpad for physical storage of the branches. But you can also decide to host your repository elsewhere - even in svn if you like, and just use Launchpad for project management. For the kss core development, we also set up the project group "kss" and the team "kssteam". We will gradually move project management of the kss core development to here, but we will still keep the core components in the CodeSpeak svn repository, and continue using our website http://kssproject.org as well. Long live KSS! -- Balazs Ree From hedleyroos at gmail.com Mon Nov 5 16:47:33 2007 From: hedleyroos at gmail.com (Hedley Roos) Date: Mon, 5 Nov 2007 17:47:33 +0200 Subject: [Kss-devel] Writing custom actions Message-ID: <776caf8b0711050747q76f0e407i51c0627e5472a13a@mail.gmail.com> Does anyone have a tutorial on how to write custom actions for kss that ships with Plone 3? I know how to do it with the older PloneAzax, but I am stuck now. The pattern is pretty much the same I guess: 1. Write a js file 2. Register actions with zcml 3. Call it in your Python Script My big problems arise when retrieving the commands. commands = core.commands works fine, but attempting to access (not even call) core.commands.addCommand causes my Python Script to bomb silently at that point. Any help greatly appreciated! Hedley From hedleyroos at gmail.com Mon Nov 5 17:00:50 2007 From: hedleyroos at gmail.com (Hedley Roos) Date: Mon, 5 Nov 2007 18:00:50 +0200 Subject: [Kss-devel] Writing custom actions In-Reply-To: <1194274529.4365.1.camel@gogolaptop> References: <776caf8b0711050747q76f0e407i51c0627e5472a13a@mail.gmail.com> <1194274529.4365.1.camel@gogolaptop> Message-ID: <776caf8b0711050800u59720d20qd3e6ab985b120923@mail.gmail.com> Thanks for the link. I'm just longing for the old 1-2-3 approach of PlonaAzax :( On Nov 5, 2007 4:55 PM, George Gozadinos wrote: > Have a look here, I was looking for the same and it was pretty useful. > https://codespeak.net/svn/kukit/docs/creating-plugins-plone-conf-2007/ > From hedleyroos at gmail.com Mon Nov 5 14:25:03 2007 From: hedleyroos at gmail.com (Hedley Roos) Date: Mon, 5 Nov 2007 15:25:03 +0200 Subject: [Kss-devel] kss and response.redirect Message-ID: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> What happens if I do context.REQUEST.RESPONSE.redirect('somewhere_in_plone_site') in my Python Script which is invoked through a kss rule? My example seems dumb, I know - I'm just abstracting a more complex use case. Basically I call existing Python Scripts which sometimes want to redirect, and then my subsequent core method calls (replaceInnerHTML etc) fail. On the flipside, how do I in fact cause my browser to redirect in said Python Script? Can I just set url.location.href (I forget the notation)? Thanks Hedley From optilude at gmx.net Mon Nov 5 21:48:15 2007 From: optilude at gmx.net (Martin Aspeli) Date: Mon, 05 Nov 2007 20:48:15 +0000 Subject: [Kss-devel] kss and response.redirect In-Reply-To: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> References: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> Message-ID: Hedley Roos wrote: > What happens if I do > > context.REQUEST.RESPONSE.redirect('somewhere_in_plone_site') > > in my Python Script which is invoked through a kss rule? Nothing, probably. :) > My example seems dumb, I know - I'm just abstracting a more complex > use case. Basically I call existing Python Scripts which sometimes > want to redirect, and then my subsequent core method calls > (replaceInnerHTML etc) fail. The response there would tell the browser to redirect to some other page. The AJAX request may even do that, I'm not sure, but unless the thing you redirected to also returned a KSS payload, the client-side handler wouldn't know what to do. > On the flipside, how do I in fact cause my browser to redirect in said > Python Script? Can I just set url.location.href (I forget the > notation)? Probably, yes. Martin -- Author of `Professional Plone Development`, a book for developers who want to work with Plone. See http://martinaspeli.net/plone-book From novotny.radim at gmail.com Tue Nov 6 06:53:40 2007 From: novotny.radim at gmail.com (Radim Novotny) Date: Tue, 06 Nov 2007 06:53:40 +0100 Subject: [Kss-devel] kss and response.redirect In-Reply-To: References: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> Message-ID: There is plone-followLink command available (which actually sets window.location), so you can define hidden, empty link in your template and use plone-followLink command, if needed. You can use something like this: ksscore = IKSSCoreCommands(self) ksscore.setAttribute('#follow-me', 'href', 'http://plone.org') self.commands.addCommand('plone-followLink', '#follow-me') return self.render() Radim > Hedley Roos wrote: >> What happens if I do >> >> context.REQUEST.RESPONSE.redirect('somewhere_in_plone_site') >> >> in my Python Script which is invoked through a kss rule? > > Nothing, probably. :) > >> My example seems dumb, I know - I'm just abstracting a more complex >> use case. Basically I call existing Python Scripts which sometimes >> want to redirect, and then my subsequent core method calls >> (replaceInnerHTML etc) fail. > > The response there would tell the browser to redirect to some other > page. The AJAX request may even do that, I'm not sure, but unless the > thing you redirected to also returned a KSS payload, the client-side > handler wouldn't know what to do. > >> On the flipside, how do I in fact cause my browser to redirect in said >> Python Script? Can I just set url.location.href (I forget the >> notation)? > > Probably, yes. From jeroen.vloothuis at xs4all.nl Tue Nov 6 08:05:12 2007 From: jeroen.vloothuis at xs4all.nl (Jeroen Vloothuis) Date: Tue, 06 Nov 2007 08:05:12 +0100 Subject: [Kss-devel] kss and response.redirect In-Reply-To: References: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> Message-ID: <47301228.70402@xs4all.nl> Radim Novotny wrote: > There is plone-followLink command available (which actually sets > window.location), so you can define hidden, empty id="somelink"> link in your template and use plone-followLink command, > if needed. > >>> On the flipside, how do I in fact cause my browser to redirect in said >>> Python Script? Can I just set url.location.href (I forget the >>> notation)? >>> >> Probably, yes. >> We might want to have an extra action for this. This could be either a plugin or part of the core actions. Could you please give some descriptions on situations where this might be useful? From hedley at upfrontsystems.co.za Tue Nov 6 09:00:59 2007 From: hedley at upfrontsystems.co.za (Hedley Roos) Date: Tue, 06 Nov 2007 10:00:59 +0200 Subject: [Kss-devel] kss and response.redirect In-Reply-To: <47301228.70402@xs4all.nl> References: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> <47301228.70402@xs4all.nl> Message-ID: <47301F3B.1050507@upfrontsystems.co.za> I'll write the action if others find it useful. I'm currently ajaxifying the entire plone join, login and password retrieval mechanism. It's going quite well. The redirect is needed when there is a came_from variable on the request. I can't just fill the center of the screen with a portion of html since I cannot be certain that the destination page template will offer me a macro that I can call, hence the redirect. If this sounds confusing tell me and I'll elaborate. My original goal was to ajaxify the entire Form Controller mechanism. I investigated it for a few hours but decided against it. I still believe it is possible to do that given more time. And I think it can be done transparently, but that's another discussion. So, to summarize: a redirect action is useful when there is no logical way to modify a portion of the DOM. hth H > We might want to have an extra action for this. This could be either a > plugin or part of the core actions. Could you please give some > descriptions on situations where this might be useful? > From hedley at upfrontsystems.co.za Tue Nov 6 09:15:58 2007 From: hedley at upfrontsystems.co.za (Hedley Roos) Date: Tue, 06 Nov 2007 10:15:58 +0200 Subject: [Kss-devel] kss and response.redirect In-Reply-To: References: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> Message-ID: <473022BE.50909@upfrontsystems.co.za> Thanks Radim That is also my intended approach, but there is a snag - I can't call addCommand from a Python Script. Maybe it needs to be exposed in ttwapi? H > > You can use something like this: > > ksscore = IKSSCoreCommands(self) > ksscore.setAttribute('#follow-me', 'href', 'http://plone.org') > self.commands.addCommand('plone-followLink', '#follow-me') > return self.render() From novotny.radim at gmail.com Tue Nov 6 10:01:49 2007 From: novotny.radim at gmail.com (Radim Novotny) Date: Tue, 06 Nov 2007 10:01:49 +0100 Subject: [Kss-devel] kss and response.redirect In-Reply-To: <473022BE.50909@upfrontsystems.co.za> References: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> <473022BE.50909@upfrontsystems.co.za> Message-ID: Hi Hedley, my example is from Plone 2.5/azax 1.1, so current syntax may be slightly different. Radim > Thanks Radim > > That is also my intended approach, but there is a snag - I can't call > addCommand from a Python Script. Maybe it needs to be exposed in ttwapi? > > H > >> You can use something like this: >> >> ksscore = IKSSCoreCommands(self) >> ksscore.setAttribute('#follow-me', 'href', 'http://plone.org') >> self.commands.addCommand('plone-followLink', '#follow-me') >> return self.render() From ree at ree.hu Tue Nov 6 10:08:05 2007 From: ree at ree.hu (Balazs Ree) Date: Tue, 6 Nov 2007 10:08:05 +0100 Subject: [Kss-devel] kss and response.redirect References: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> <47301228.70402@xs4all.nl> Message-ID: On Tue, 06 Nov 2007 08:05:12 +0100, Jeroen Vloothuis wrote: > Radim Novotny wrote: >> There is plone-followLink command available (which actually sets >> window.location), so you can define hidden, empty > id="somelink"> link in your template and use plone-followLink command, >> if needed. >> >>>> On the flipside, how do I in fact cause my browser to redirect in >>>> said Python Script? Can I just set url.location.href (I forget the >>>> notation)? >>>> >>> Probably, yes. >>> > We might want to have an extra action for this. This could be either a > plugin or part of the core actions. Could you please give some > descriptions on situations where this might be useful? Redirect is actually a good idea to implement. The only reason that it does not exist, is that noone needed it so far. The name could be followUrl? or redirect? I believe also plone-followLink and plone-submitForm has to come into a separate command set, since it is not Plone or even Zope specific. Together with the newly proposed followUrl (?) action. These all together can either go into the core command set, or it may even be a better idea to make a separate "url" (?) command set that is responsible for url and submit related functionality. If we keep it separate it even has the advantage that it can be developed independently and if ready we can distribute it with the core. Also we don't bloat "core" plugin unnecessarily big. Opinions? -- Balazs Ree From hedley at upfrontsystems.co.za Tue Nov 6 10:56:36 2007 From: hedley at upfrontsystems.co.za (Hedley Roos) Date: Tue, 06 Nov 2007 11:56:36 +0200 Subject: [Kss-devel] Writing custom actions In-Reply-To: <776caf8b0711050800u59720d20qd3e6ab985b120923@mail.gmail.com> References: <776caf8b0711050747q76f0e407i51c0627e5472a13a@mail.gmail.com> <1194274529.4365.1.camel@gogolaptop> <776caf8b0711050800u59720d20qd3e6ab985b120923@mail.gmail.com> Message-ID: <47303A54.4090005@upfrontsystems.co.za> That example definitely works! Highly recommended if you're stuck with custom actions. > > On Nov 5, 2007 4:55 PM, George Gozadinos wrote: >> Have a look here, I was looking for the same and it was pretty useful. >> https://codespeak.net/svn/kukit/docs/creating-plugins-plone-conf-2007/ >> From hedley at upfrontsystems.co.za Tue Nov 6 16:59:35 2007 From: hedley at upfrontsystems.co.za (Hedley Roos) Date: Tue, 06 Nov 2007 17:59:35 +0200 Subject: [Kss-devel] Get currentForm to put items on request Message-ID: <47308F67.9010108@upfrontsystems.co.za> Is there a way to get currentForm to not just pass a dictionary to the Python Script parameter but to actually put the values on the request. My kss rule: input#login-form-submit:click { evt-click-preventdefault: True; action-server: kss_login_form; kss_login_form-form: currentForm(); } And subsequently in my Python Script request.form has value {'form':{'foo':1', 'bar':'2'}} What I would like to do is "collapse" that dictionary and have foo and bar on my request directly, ie. request.get('foo') returns 1. A while back I wrote a Zope compatible marshaller in javascript for azax. IIRC there is a point where an url is constructed in javascript. Currently this is something like ?form.foo=1&form.bar=2 (this is all from memory). It should be trivial to do ?foo=1&bar=2 Why do I want this? Well, ZPublisher et al kicks in before my Python Script is evaluated, which means my authentication info for one is incorrect since the request is not in the expected state. Ideas Balazs, Godefroid? Thanks Hedley From ree at ree.hu Tue Nov 6 18:34:51 2007 From: ree at ree.hu (Balazs Ree) Date: Tue, 6 Nov 2007 18:34:51 +0100 Subject: [Kss-devel] Get currentForm to put items on request References: <47308F67.9010108@upfrontsystems.co.za> Message-ID: On Tue, 06 Nov 2007 17:59:35 +0200, Hedley Roos wrote: > Is there a way to get currentForm to not just pass a dictionary to the > Python Script parameter but to actually put the values on the request. > > My kss rule: > > input#login-form-submit:click { > evt-click-preventdefault: True; > action-server: kss_login_form; > kss_login_form-form: currentForm(); > } currentForm marshalling the way you use it is deprecated. Knowingly broken and won't fix. Explanation comes below... Read the deprecation warning from the kss log in Firebug, and follow it. If still unclear what to do, please also read point 2.7 in http://plone.org/documentation/howto/how-to-setup-and-use-kss-on-plone-3.0 - snip - > A while back I wrote a Zope compatible marshaller in javascript for > azax. IIRC there is a point where an url is constructed in javascript. > Currently this is something like ?form.foo=1&form.bar=2 (this is > all from memory). It should be trivial to do ?foo=1&bar=2 We realized that this approach, besides it is specific to Zope, would require lot of code to be feature complete and would never work well. We decided to use another approach: to always send the whole form untouched. Advantage: all Zope marshalling just works without any extra support from javascript. (I remember having a thread on the mailing list as well, but not 100% sure.) > Why do I want this? Well, ZPublisher et al kicks in before my Python > Script is evaluated, which means my authentication info for one is > incorrect since the request is not in the expected state. Please try the supported way and report if you still have this problem. Best wishes -- Balazs Ree From novotny.radim at gmail.com Tue Nov 6 20:19:35 2007 From: novotny.radim at gmail.com (Radim Novotny) Date: Tue, 06 Nov 2007 20:19:35 +0100 Subject: [Kss-devel] Get currentForm to put items on request In-Reply-To: References: <47308F67.9010108@upfrontsystems.co.za> Message-ID: <4730BE47.20300@gmail.com> > > Read the deprecation warning from the kss log in Firebug, and follow it. > If still unclear what to do, please also read point 2.7 in > http://plone.org/documentation/howto/how-to-setup-and-use-kss-on-plone-3.0 > The right syntax of the code example (in my opinion) is: action-server: myServerAction; myServerAction-kssSubmitForm: currentForm(); What do you think, Balazs ? -- Radim From hedleyroos at gmail.com Tue Nov 6 20:52:39 2007 From: hedleyroos at gmail.com (Hedley Roos) Date: Tue, 6 Nov 2007 21:52:39 +0200 Subject: [Kss-devel] Get currentForm to put items on request In-Reply-To: <4730BE47.20300@gmail.com> References: <47308F67.9010108@upfrontsystems.co.za> <4730BE47.20300@gmail.com> Message-ID: <776caf8b0711061152y6592f94apac65b73728d17fa0@mail.gmail.com> That is correct. Thanks Radim - I didn't know about that. From ree at ree.hu Tue Nov 6 21:12:28 2007 From: ree at ree.hu (Balazs Ree) Date: Tue, 6 Nov 2007 21:12:28 +0100 Subject: [Kss-devel] Get currentForm to put items on request References: <47308F67.9010108@upfrontsystems.co.za> <4730BE47.20300@gmail.com> Message-ID: On Tue, 06 Nov 2007 20:19:35 +0100, Radim Novotny wrote: > The right syntax of the code example (in my opinion) is: > > action-server: myServerAction; > myServerAction-kssSubmitForm: currentForm(); > > What do you think, Balazs ? So right! Thanks for poining this out. (fixed) -- Balazs Ree From hedley at upfrontsystems.co.za Thu Nov 8 09:33:47 2007 From: hedley at upfrontsystems.co.za (Hedley Roos) Date: Thu, 08 Nov 2007 10:33:47 +0200 Subject: [Kss-devel] Form submittal by pressing Enter key Message-ID: <4732C9EB.8060906@upfrontsystems.co.za> I have a form with a single . Clicking the button is handled by :submit, but not pressing the Enter key. This is the behaviour in Firefox - not sure about IE. Anyone have a workaround? From gotcha at bubblenet.be Thu Nov 8 09:39:35 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Thu, 08 Nov 2007 09:39:35 +0100 Subject: [Kss-devel] Form submittal by pressing Enter key In-Reply-To: <4732C9EB.8060906@upfrontsystems.co.za> References: <4732C9EB.8060906@upfrontsystems.co.za> Message-ID: <4732CB47.3020708@bubblenet.be> Hedley Roos wrote: > I have a form with a single . Clicking the button > is handled by :submit, but not pressing the Enter key. This is the > behaviour in Firefox - not sure about IE. > > Anyone have a workaround? I do not understand your quesion -- Godefroid Chapelle (aka __gotcha) http://bubblenet.be From hedley at upfrontsystems.co.za Thu Nov 8 09:48:54 2007 From: hedley at upfrontsystems.co.za (Hedley Roos) Date: Thu, 08 Nov 2007 10:48:54 +0200 Subject: [Kss-devel] Form submittal by pressing Enter key In-Reply-To: <4732CB47.3020708@bubblenet.be> References: <4732C9EB.8060906@upfrontsystems.co.za> <4732CB47.3020708@bubblenet.be> Message-ID: <4732CD76.3050403@upfrontsystems.co.za> I'll elaborate :) Page Template:
kss rule: form#my_form:submit { action-server: kss_some_script; kss_some_script-kssSubmitForm: currentForm(); } When I click on the submit button kss_some_script is called as expected, but if I just press the Enter key then it is not (the form just gets submitted the normal non-ajax way). Maybe I should just detect keypresses on the entire form? H From gotcha at bubblenet.be Thu Nov 8 09:52:21 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Thu, 08 Nov 2007 09:52:21 +0100 Subject: [Kss-devel] Form submittal by pressing Enter key In-Reply-To: <4732CD76.3050403@upfrontsystems.co.za> References: <4732C9EB.8060906@upfrontsystems.co.za> <4732CB47.3020708@bubblenet.be> <4732CD76.3050403@upfrontsystems.co.za> Message-ID: <4732CE45.60801@bubblenet.be> Hedley Roos wrote: > I'll elaborate :) > > Page Template: > >
method="post" > id="my_form"> > > >
> > kss rule: > > form#my_form:submit { > action-server: kss_some_script; > kss_some_script-kssSubmitForm: currentForm(); > } > > When I click on the submit button kss_some_script is called as expected, > but if I just press the Enter key then it is not (the form just gets > submitted the normal non-ajax way). > > Maybe I should just detect keypresses on the entire form? Right, you should use keypresses... Look at Plone 3 code for inline edit. -- Godefroid Chapelle (aka __gotcha) http://bubblenet.be From ree at ree.hu Thu Nov 8 11:03:04 2007 From: ree at ree.hu (Balazs Ree) Date: Thu, 8 Nov 2007 11:03:04 +0100 Subject: [Kss-devel] kss.demo 1.2 issues Message-ID: Hi, just noticed there are still the following issues with kss.demo on the 1.2 release branch. (Both is good on trunk.) - demo plugins are not loaded (empty screen) depending on zcml loading order. This may be good or bad depending on the site setup and whether or not buildout is used. The issue is fixed on trunk in -r47443. - The ecma unittests are still broken if run from the demo from Zope. I think it was broken during enhancements in the LLN sprint. Godefroid previously fixed in the trunk with Laurent and Jeff, but it was never fixed on 1.2. Best wishes, -- Balazs Ree From gotcha at bubblenet.be Thu Nov 8 11:13:45 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Thu, 08 Nov 2007 11:13:45 +0100 Subject: [Kss-devel] kss.demo 1.2 issues In-Reply-To: References: Message-ID: <4732E159.70802@bubblenet.be> Balazs Ree wrote: > Hi, > > just noticed there are still the following issues with kss.demo on the > 1.2 release branch. (Both is good on trunk.) > > - demo plugins are not loaded (empty screen) depending on zcml loading > order. This may be good or bad depending on the site setup and whether or > not buildout is used. The issue is fixed on trunk in -r47443. What do you call demo plugins ? > > - The ecma unittests are still broken if run from the demo from Zope. I > think it was broken during enhancements in the LLN sprint. Godefroid > previously fixed in the trunk with Laurent and Jeff, but it was never > fixed on 1.2. They were broken before LLN sprint (might be my fault). IIRC, LLN sprint worked only on trunk so we could not have broken 1.2 branch. > > Best wishes, > -- Godefroid Chapelle (aka __gotcha) http://bubblenet.be From ree at ree.hu Thu Nov 8 11:40:47 2007 From: ree at ree.hu (Balazs Ree) Date: Thu, 8 Nov 2007 11:40:47 +0100 Subject: [Kss-devel] kss.demo 1.2 issues References: <4732E159.70802@bubblenet.be> Message-ID: On Thu, 08 Nov 2007 11:13:45 +0100, Godefroid Chapelle wrote: > Balazs Ree wrote: >> Hi, >> >> just noticed there are still the following issues with kss.demo on the >> 1.2 release branch. (Both is good on trunk.) >> >> - demo plugins are not loaded (empty screen) depending on zcml loading >> order. This may be good or bad depending on the site setup and whether >> or not buildout is used. The issue is fixed on trunk in -r47443. > > What do you call demo plugins ? Please ignore my imperfect way of calling them plugins. I try to rephrase it more clearly: none of the demos appear when you go to the demos page. >> - The ecma unittests are still broken if run from the demo from Zope. I >> think it was broken during enhancements in the LLN sprint. Godefroid >> previously fixed in the trunk with Laurent and Jeff, but it was never >> fixed on 1.2. > > They were broken before LLN sprint (might be my fault). > > IIRC, LLN sprint worked only on trunk so we could not have broken 1.2 > branch. > Just wanted to point out that the problem still persists, I did not say it was your fault. I assumed since you fixed it in the trunk you could do that easily on the branch too. If you prefer not to take this one, just tell me and I pick it up (not today though). Best wishes, -- Balazs Ree From hedley at upfrontsystems.co.za Thu Nov 8 14:55:45 2007 From: hedley at upfrontsystems.co.za (Hedley Roos) Date: Thu, 08 Nov 2007 15:55:45 +0200 Subject: [Kss-devel] "Could not adapt" error with event subscribers firing during an ajax call Message-ID: <47331561.8070801@upfrontsystems.co.za> David Bain gives a complete explanation at http://lists.plone.org/pipermail/product-developers/2007-October/000882.html This is a straight copy-and-paste from that page. My comments below... ----- snippet --- I have some code that creates a simple folder. It seems that when invokeFactory is called via a "kss wrapper", the result is a 'could not adapt' error. Maybe I'm misinterpreting this, anyone familiar with this issue? Would love your assistance. I've included traceback and snippets of the original code, I figure that should help. Note: - that when the method is called directly or via a non-kss based method it works fine. - When called wrapped in a kss based method I get a 'could not adapt' error. the traceback when called from my KSS based method: 2007-10-23 07:46:06 ERROR Zope.SiteErrorLog http://localhost:8081/Plone/poleroll/my-roll/kss_do_stuff/do_stuff Traceback (innermost last): Module ZPublisher.Publish, line 119, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 42, in call_object Module , line 5, in wrapper Module kss.core.actionwrapper, line 238, in apply Module Products.peopleroll.browser.dostuff, line 12, in do_stuff Module Products.peopleroll.content.organization, line 276, in do_the_stuff Module Products.CMFCore.PortalFolder, line 315, in invokeFactory Module Products.CMFCore.TypesTool, line 716, in constructContent Module Products.CMFCore.TypesTool, line 276, in constructInstance Module Products.CMFCore.TypesTool, line 450, in _constructInstance Module Products.ATContentTypes.content.folder, line 7, in addATFolder Module OFS.ObjectManager, line 348, in _setObject Module zope.app.container.contained, line 365, in notifyContainerModified Module zope.event, line 23, in notify Module zope.component.event, line 26, in dispatch Module zope.component._api, line 130, in subscribers Module zope.component.registry, line 290, in subscribers Module zope.interface.adapter, line 535, in subscribers Module kss.core.kssview, line 127, in _eventRedispatcher Module zope.component._api, line 130, in subscribers Module zope.component.registry, line 290, in subscribers Module zope.interface.adapter, line 535, in subscribers Module plone.app.kss.globalui, line 23, in attributesTriggerDocumentBylineReload Module kss.core.kssview, line 169, in getCommandSet TypeError: ('Could not adapt', , ) The Original Method from a content type called an organization: ----snip--- security.declarePublic('do_the_stuff') def do_the_stuff(self,results, **kwargs): """ do stuff here """ dtnow = DateTime() year = str(DateTime.year(dtnow)) if year not in self.contentIds(): self.invokeFactory(id=year,title=year,type_name="Folder") ----snip--- The KSS class: from kss.core import KSSView, kssaction from Acquisition import aq_inner from datetime import datetime class DoTheStuff(KSSView): @kssaction def do_stuff(self, widgetid='blah', href='yah.com'): ksscore = self.getCommandSet('core') selector = ksscore.getHtmlIdSelector('organization-results') do_it = self.context.do_the_stuff output = do_it() ksscore.replaceInnerHTML(selector, '

%s

' % output) -------------- next part -------------- ----- snippet --- I have the exact same error when trying to call portal_membership.addMember during an ajax call. It seems that an event subscriber notifyContainerModified branches off into some code that updates the document byline via ajax. From globalui.py we have @component.adapter(None, IKSSView, IObjectModifiedEvent) def attributesTriggerDocumentBylineReload(obj, view, event): ksscore = view.getCommandSet('core') selector = ksscore.getHtmlIdSelector('plone-document-byline') zopecommands = view.getCommandSet('zope') zopecommands.refreshViewlet(selector, 'plone.belowcontenttitle', 'plone.belowcontenttitle.documentbyline') From kssview.py we have def getCommandSet(self, name): commandset = getRegisteredCommandSet(name) # return the adapted view return commandset.provides(self) getCommandSet successfully retrieves the core commandset, but the "could not adapt" error happens when trying to retrieve the zope commandset. At first I thought that the calling context must be wrong (the commandset.provides(self) bit), but how can that be? self is surely a view? So, bit stuck here. David Bain also received no replies. Anyone else have this issue? Hedley From ree at ree.hu Thu Nov 8 19:27:19 2007 From: ree at ree.hu (Balazs Ree) Date: Thu, 8 Nov 2007 19:27:19 +0100 Subject: [Kss-devel] "Could not adapt" error with event subscribers firing during an ajax call References: <47331561.8070801@upfrontsystems.co.za> Message-ID: On Thu, 08 Nov 2007 15:55:45 +0200, Hedley Roos wrote: > David Bain gives a complete explanation at > http://lists.plone.org/pipermail/product-developers/2007- October/000882.html > So, bit stuck here. David Bain also received no replies. Anyone else > have this issue? > > Hedley Thanks for bringing this up. We will have a look at it. Portal_factory issue surely does not look good, so please do not ecpect an answer soon. It may also be a good idea to report a bug to the bug tracker, next time. -- Balazs Ree From jeroen.vloothuis at xs4all.nl Fri Nov 9 07:52:13 2007 From: jeroen.vloothuis at xs4all.nl (Jeroen Vloothuis) Date: Fri, 09 Nov 2007 07:52:13 +0100 Subject: [Kss-devel] "Could not adapt" error with event subscribers firing during an ajax call In-Reply-To: References: <47331561.8070801@upfrontsystems.co.za> Message-ID: <4734039D.8060704@xs4all.nl> Balazs Ree wrote: > On Thu, 08 Nov 2007 15:55:45 +0200, Hedley Roos wrote: > > >> David Bain gives a complete explanation at >> http://lists.plone.org/pipermail/product-developers/2007- >> > October/000882.html > > >> So, bit stuck here. David Bain also received no replies. Anyone else >> have this issue? >> To have a workaround for now you could make a subclass off KSSView and use that as the base for your view. In this subclass you would override the `_eventRedispatcher(self, event)`. You can find its default implementation in kss.core.kssview. Now you can and add a try except around a call to the orginal implementation. This should at least get you up and running again. Perhaps we should make handling these subscribers more robust by default? From ree at ree.hu Fri Nov 9 08:08:09 2007 From: ree at ree.hu (Balazs Ree) Date: Fri, 9 Nov 2007 08:08:09 +0100 Subject: [Kss-devel] "Could not adapt" error with event subscribers firing during an ajax call References: <47331561.8070801@upfrontsystems.co.za> <4734039D.8060704@xs4all.nl> Message-ID: On Fri, 09 Nov 2007 07:52:13 +0100, Jeroen Vloothuis wrote: > Perhaps we should make handling these subscribers more robust by > default? This is an important question and we already talked about it a bit. We can have two basic approaches: 1. let an exception raised as currently This has the advantage that we consider the things that are done by the event handlers not optional but essential part of the application. If they do not happen the application is broken, it is best to signal that with an exception so we are forced to fix it 2. swallow them generically and maybe log it This has several problems. First part of the application is silently not running correctly altough it seems to run. Second we usually do not discover if this happens. Third it is against the "explicit is better then implicit" principle. Let me tell a real life example. There are currently two event handlers on plone.app.kss trunk, that are broken for whatsoever reason (probably another component programmer made a change somewhere else, without caring that our tests actually fail as a consequence). I did not want plone trunk to break entirely but I also did not have time to fix them yet. So I disabled the event handler code and I am logging an ERROR saying that the code needs to be fixed each time it is invoked. Even this way, because I disabled the exceptions, probably none of you have noticed that there is a problem at all. So fixing the problem is pushed to infinity. But at least I needed to manually disable the events which is I believe much better then the option 2. when it would just magically happen. However in current case I suggest we really take a deep look of what happens, because acquisition + portal_factory problems can be a real pain if ignored. -- Balazs Ree From gotcha at bubblenet.be Sat Nov 10 14:29:18 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Sat, 10 Nov 2007 14:29:18 +0100 Subject: [Kss-devel] kss and response.redirect In-Reply-To: References: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> <47301228.70402@xs4all.nl> Message-ID: <4735B22E.9060804@bubblenet.be> Balazs Ree wrote: > On Tue, 06 Nov 2007 08:05:12 +0100, Jeroen Vloothuis wrote: > >> Radim Novotny wrote: >>> There is plone-followLink command available (which actually sets >>> window.location), so you can define hidden, empty
>> id="somelink"> link in your template and use plone-followLink command, >>> if needed. >>> >>>>> On the flipside, how do I in fact cause my browser to redirect in >>>>> said Python Script? Can I just set url.location.href (I forget the >>>>> notation)? >>>>> >>>> Probably, yes. >>>> >> We might want to have an extra action for this. This could be either a >> plugin or part of the core actions. Could you please give some >> descriptions on situations where this might be useful? > > Redirect is actually a good idea to implement. The only reason that it > does not exist, is that noone needed it so far. Exact > > The name could be followUrl? or redirect? I would all it redirect because it is the word we all know his from HTTP > > I believe also plone-followLink and plone-submitForm has to come into a > separate command set, since it is not Plone or even Zope specific. > Together with the newly proposed followUrl (?) action. Agreed > > These all together can either go into the core command set, or it may > even be a better idea to make a separate "url" (?) command set that is > responsible for url and submit related functionality. I like the url idea ! > > If we keep it separate it even has the advantage that it can be developed > independently and if ready we can distribute it with the core. Also we > don't bloat "core" plugin unnecessarily big. > > Opinions? > Hereabove ;-) -- Godefroid Chapelle (aka __gotcha) http://bubblenet.be From gotcha at bubblenet.be Sat Nov 10 14:30:52 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Sat, 10 Nov 2007 14:30:52 +0100 Subject: [Kss-devel] kss and response.redirect In-Reply-To: <473022BE.50909@upfrontsystems.co.za> References: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> <473022BE.50909@upfrontsystems.co.za> Message-ID: <4735B28C.9080808@bubblenet.be> Hedley Roos wrote: > Thanks Radim > > That is also my intended approach, but there is a snag - I can't call > addCommand from a Python Script. Maybe it needs to be exposed in ttwapi? > > H > >> You can use something like this: >> >> ksscore = IKSSCoreCommands(self) >> ksscore.setAttribute('#follow-me', 'href', 'http://plone.org') >> self.commands.addCommand('plone-followLink', '#follow-me') >> return self.render() If you register your action in a commandset, you won't need to use addCommand. IIRC, there is an explanation how to create a command set in Jeroen's presentation. -- Godefroid Chapelle (aka __gotcha) http://bubblenet.be From gotcha at bubblenet.be Sat Nov 10 14:39:31 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Sat, 10 Nov 2007 14:39:31 +0100 Subject: [Kss-devel] "Could not adapt" error with event subscribers firing during an ajax call In-Reply-To: References: <47331561.8070801@upfrontsystems.co.za> <4734039D.8060704@xs4all.nl> Message-ID: Balazs Ree wrote: > On Fri, 09 Nov 2007 07:52:13 +0100, Jeroen Vloothuis wrote: >> Perhaps we should make handling these subscribers more robust by >> default? > > This is an important question and we already talked about it a bit. We > can have two basic approaches: > > 1. let an exception raised as currently > > This has the advantage that we consider the things that are done by the > event handlers not optional but essential part of the application. If > they do not happen the application is broken, it is best to signal that > with an exception so we are forced to fix it I totally agree this is the way to go. UI of Ajax application does not work if Ajax actions result in incoherent screens. In a component world, the only way (that I know) to let other UI components to know about changes of state of objects they display is the subscriber--observer pattern. Obviouly this implies subscribers need to be robust enough, which is hard. > > 2. swallow them generically and maybe log it > > This has several problems. First part of the application is silently not > running correctly altough it seems to run. Second we usually do not > discover if this happens. Third it is against the "explicit is better > then implicit" principle. > > > Let me tell a real life example. There are currently two event handlers > on plone.app.kss trunk, that are broken for whatsoever reason (probably > another component programmer made a change somewhere else, without caring > that our tests actually fail as a consequence). I did not want plone > trunk to break entirely but I also did not have time to fix them yet. So > I disabled the event handler code and I am logging an ERROR saying that > the code needs to be fixed each time it is invoked. > > Even this way, because I disabled the exceptions, probably none of you > have noticed that there is a problem at all. So fixing the problem is > pushed to infinity. But at least I needed to manually disable the events > which is I believe much better then the option 2. when it would just > magically happen. > > > However in current case I suggest we really take a deep look of what > happens, because acquisition + portal_factory problems can be a real pain > if ignored. > -- Godefroid Chapelle (aka __gotcha) http://bubblenet.be From gotcha at bubblenet.be Sat Nov 10 14:46:58 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Sat, 10 Nov 2007 14:46:58 +0100 Subject: [Kss-devel] launchpad setup for kissbooth In-Reply-To: References: Message-ID: <4735B652.9050807@bubblenet.be> Balazs Ree wrote: > Kissbooth is now on Launchpad. http://launchpad.net/kissbooth > > The launchpad team has kindly finished the setup of our registration for > the "kissbooth" project as we requested. "Kissbooth" will play a role for > kss as does the collective for Plone: it will enable the community > development of kss plugins here, and experimental extensions for the kss > core as well. Access is granted to a wide developer community. > > We already started to use it after the plone.app.kss sprint in Naples, > > ... and now we have in Launchpad: > > - a super-project "kissbooth" > > - a team "kissbooth" > > Remember, a team and a project are separate entities in Launchpad. You > want to use both the team and the project group to share your code with > the community. > > If you want to register your project as part of "kissbooth", you need to > > - register an account on Launchpad, and sign up to be a member of > the team "kissbooth". We will approve you soon. > > - register your project on Launchpad with the name you prefer > (we suggest the dotted import name of the python component, > and in case of general purpose kss plugins, you can also use > the namespace kss.plugin.yourplugin) > > - make this project as part of the "kissbooth" project group, and > > - (optionally) make the Owner of the project the "kissbooth" team. > > This will make sure that all kissbooth members have access to the project > in the future. > > - Then: go ahead defining your project details, and create branches, > blueprints as you wish... You can use the launchpad servers to store > bzr branches for your project as well. > > We encourage the use of the Bazaaz repository and use Launchpad for > physical storage of the branches. But you can also decide to host your > repository elsewhere - even in svn if you like, and just use Launchpad > for project management. > > For the kss core development, we also set up the project group "kss" and > the team "kssteam". We will gradually move project management of the kss > core development to here, but we will still keep the core components in > the CodeSpeak svn repository, and continue using our website > http://kssproject.org as well. > > Long live KSS! > Thanks a lot for having done the communication with LaunchPad team. -- Godefroid Chapelle (aka __gotcha) http://bubblenet.be From gotcha at bubblenet.be Sat Nov 10 14:29:18 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Sat, 10 Nov 2007 14:29:18 +0100 Subject: [Kss-devel] kss and response.redirect In-Reply-To: References: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> <47301228.70402@xs4all.nl> Message-ID: <4735B22E.9060804@bubblenet.be> Balazs Ree wrote: > On Tue, 06 Nov 2007 08:05:12 +0100, Jeroen Vloothuis wrote: > >> Radim Novotny wrote: >>> There is plone-followLink command available (which actually sets >>> window.location), so you can define hidden, empty >> id="somelink"> link in your template and use plone-followLink command, >>> if needed. >>> >>>>> On the flipside, how do I in fact cause my browser to redirect in >>>>> said Python Script? Can I just set url.location.href (I forget the >>>>> notation)? >>>>> >>>> Probably, yes. >>>> >> We might want to have an extra action for this. This could be either a >> plugin or part of the core actions. Could you please give some >> descriptions on situations where this might be useful? > > Redirect is actually a good idea to implement. The only reason that it > does not exist, is that noone needed it so far. Exact > > The name could be followUrl? or redirect? I would all it redirect because it is the word we all know his from HTTP > > I believe also plone-followLink and plone-submitForm has to come into a > separate command set, since it is not Plone or even Zope specific. > Together with the newly proposed followUrl (?) action. Agreed > > These all together can either go into the core command set, or it may > even be a better idea to make a separate "url" (?) command set that is > responsible for url and submit related functionality. I like the url idea ! > > If we keep it separate it even has the advantage that it can be developed > independently and if ready we can distribute it with the core. Also we > don't bloat "core" plugin unnecessarily big. > > Opinions? > Hereabove ;-) -- Godefroid Chapelle (aka __gotcha) http://bubblenet.be From gotcha at bubblenet.be Sat Nov 10 14:30:52 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Sat, 10 Nov 2007 14:30:52 +0100 Subject: [Kss-devel] kss and response.redirect In-Reply-To: <473022BE.50909@upfrontsystems.co.za> References: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> <473022BE.50909@upfrontsystems.co.za> Message-ID: <4735B28C.9080808@bubblenet.be> Hedley Roos wrote: > Thanks Radim > > That is also my intended approach, but there is a snag - I can't call > addCommand from a Python Script. Maybe it needs to be exposed in ttwapi? > > H > >> You can use something like this: >> >> ksscore = IKSSCoreCommands(self) >> ksscore.setAttribute('#follow-me', 'href', 'http://plone.org') >> self.commands.addCommand('plone-followLink', '#follow-me') >> return self.render() If you register your action in a commandset, you won't need to use addCommand. IIRC, there is an explanation how to create a command set in Jeroen's presentation. -- Godefroid Chapelle (aka __gotcha) http://bubblenet.be From gotcha at bubblenet.be Sat Nov 10 14:46:58 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Sat, 10 Nov 2007 14:46:58 +0100 Subject: [Kss-devel] launchpad setup for kissbooth In-Reply-To: References: Message-ID: <4735B652.9050807@bubblenet.be> Balazs Ree wrote: > Kissbooth is now on Launchpad. http://launchpad.net/kissbooth > > The launchpad team has kindly finished the setup of our registration for > the "kissbooth" project as we requested. "Kissbooth" will play a role for > kss as does the collective for Plone: it will enable the community > development of kss plugins here, and experimental extensions for the kss > core as well. Access is granted to a wide developer community. > > We already started to use it after the plone.app.kss sprint in Naples, > > ... and now we have in Launchpad: > > - a super-project "kissbooth" > > - a team "kissbooth" > > Remember, a team and a project are separate entities in Launchpad. You > want to use both the team and the project group to share your code with > the community. > > If you want to register your project as part of "kissbooth", you need to > > - register an account on Launchpad, and sign up to be a member of > the team "kissbooth". We will approve you soon. > > - register your project on Launchpad with the name you prefer > (we suggest the dotted import name of the python component, > and in case of general purpose kss plugins, you can also use > the namespace kss.plugin.yourplugin) > > - make this project as part of the "kissbooth" project group, and > > - (optionally) make the Owner of the project the "kissbooth" team. > > This will make sure that all kissbooth members have access to the project > in the future. > > - Then: go ahead defining your project details, and create branches, > blueprints as you wish... You can use the launchpad servers to store > bzr branches for your project as well. > > We encourage the use of the Bazaaz repository and use Launchpad for > physical storage of the branches. But you can also decide to host your > repository elsewhere - even in svn if you like, and just use Launchpad > for project management. > > For the kss core development, we also set up the project group "kss" and > the team "kssteam". We will gradually move project management of the kss > core development to here, but we will still keep the core components in > the CodeSpeak svn repository, and continue using our website > http://kssproject.org as well. > > Long live KSS! > Thanks a lot for having done the communication with LaunchPad team. -- Godefroid Chapelle (aka __gotcha) http://bubblenet.be From gotcha at bubblenet.be Sat Nov 10 14:51:03 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Sat, 10 Nov 2007 14:51:03 +0100 Subject: [Kss-devel] kss and response.redirect In-Reply-To: <4735B22E.9060804@bubblenet.be> References: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> <47301228.70402@xs4all.nl> <4735B22E.9060804@bubblenet.be> Message-ID: <4735B747.5050002@bubblenet.be> Godefroid Chapelle wrote: > Balazs Ree wrote: >> On Tue, 06 Nov 2007 08:05:12 +0100, Jeroen Vloothuis wrote: >> >>> Radim Novotny wrote: >>>> There is plone-followLink command available (which actually sets >>>> window.location), so you can define hidden, empty >>> id="somelink"> link in your template and use plone-followLink command, >>>> if needed. >>>> >>>>>> On the flipside, how do I in fact cause my browser to redirect in >>>>>> said Python Script? Can I just set url.location.href (I forget the >>>>>> notation)? >>>>>> >>>>> Probably, yes. >>>>> >>> We might want to have an extra action for this. This could be either a >>> plugin or part of the core actions. Could you please give some >>> descriptions on situations where this might be useful? >> Redirect is actually a good idea to implement. The only reason that it >> does not exist, is that noone needed it so far. > > Exact > >> The name could be followUrl? or redirect? > > I would all it redirect because it is the word we all know his from HTTP Let's translate my bad wording. I would call it `redirect` because we all use the word from HTTP protocol. >> I believe also plone-followLink and plone-submitForm has to come into a >> separate command set, since it is not Plone or even Zope specific. >> Together with the newly proposed followUrl (?) action. > > Agreed > >> These all together can either go into the core command set, or it may >> even be a better idea to make a separate "url" (?) command set that is >> responsible for url and submit related functionality. > > I like the url idea ! >> If we keep it separate it even has the advantage that it can be developed >> independently and if ready we can distribute it with the core. Also we >> don't bloat "core" plugin unnecessarily big. >> >> Opinions? >> > > Hereabove ;-) > -- Godefroid Chapelle (aka __gotcha) http://bubblenet.be From gotcha at bubblenet.be Sat Nov 10 14:51:03 2007 From: gotcha at bubblenet.be (Godefroid Chapelle) Date: Sat, 10 Nov 2007 14:51:03 +0100 Subject: [Kss-devel] kss and response.redirect In-Reply-To: <4735B22E.9060804@bubblenet.be> References: <776caf8b0711050525u420eaf5n9f643b510ce4d06@mail.gmail.com> <47301228.70402@xs4all.nl> <4735B22E.9060804@bubblenet.be> Message-ID: <4735B747.5050002@bubblenet.be> Godefroid Chapelle wrote: > Balazs Ree wrote: >> On Tue, 06 Nov 2007 08:05:12 +0100, Jeroen Vloothuis wrote: >> >>> Radim Novotny wrote: >>>> There is plone-followLink command available (which actually sets >>>> window.location), so you can define hidden, empty >>> id="somelink"> link in your template and use plone-followLink command, >>>> if needed. >>>> >>>>>> On the flipside, how do I in fact cause my browser to redirect in >>>>>> said Python Script? Can I just set url.location.href (I forget the >>>>>> notation)? >>>>>> >>>>> Probably, yes. >>>>> >>> We might want to have an extra action for this. This could be either a >>> plugin or part of the core actions. Could you please give some >>> descriptions on situations where this might be useful? >> Redirect is actually a good idea to implement. The only reason that it >> does not exist, is that noone needed it so far. > > Exact > >> The name could be followUrl? or redirect? > > I would all it redirect because it is the word we all know his from HTTP Let's translate my bad wording. I would call it `redirect` because we all use the word from HTTP protocol. >> I believe also plone-followLink and plone-submitForm has to come into a >> separate command set, since it is not Plone or even Zope specific. >> Together with the newly proposed followUrl (?) action. > > Agreed > >> These all together can either go into the core command set, or it may >> even be a better idea to make a separate "url" (?) command set that is >> responsible for url and submit related functionality. > > I like the url idea ! >> If we keep it separate it even has the advantage that it can be developed >> independently and if ready we can distribute it with the core. Also we >> don't bloat "core" plugin unnecessarily big. >> >> Opinions? >> > > Hereabove ;-) > -- Godefroid Chapelle (aka __gotcha) http://bubblenet.be From jc at upfrontsystems.co.za Sun Nov 11 13:15:49 2007 From: jc at upfrontsystems.co.za (JC Brand) Date: Sun, 11 Nov 2007 14:15:49 +0200 Subject: [Kss-devel] File upload when submitting a form via kss. Message-ID: <4736F275.3000609@upfrontsystems.co.za> Hi guys, I'm using PloneAzax 1.1alpha1 on Plone 2.5.3. I have the following kss rule: input.kssPreviewAd:click { evt-click-preventdefault: True; action-server: @@wboutils/previewAd; @@wboutils/previewAd-kssSubmitForm: currentForm(); } One of the fields in the form I'm submitting is an ImageField. Normally the value on the REQUEST for an ImageField is a FileUpload object, but with kss the value in REQUEST.kssSubmitForm is a string containing the filesystem path to the image file. Is there anything that I can do to ensure that the form is marshaled in such a way that I can get a FileUpload object instead of a string? Thanks for any help. JC From ree at ree.hu Sun Nov 11 20:18:22 2007 From: ree at ree.hu (Balazs Ree) Date: Sun, 11 Nov 2007 20:18:22 +0100 Subject: [Kss-devel] File upload when submitting a form via kss. References: <4736F275.3000609@upfrontsystems.co.za> Message-ID: On Sun, 11 Nov 2007 14:15:49 +0200, JC Brand wrote: > Is there anything that I can do to ensure that the form is marshaled in > such a way that I can get a FileUpload object instead of a string? No. There is no way to access the content of a file from javascript. The browsers make this sure for security reasons: so that malicious web code could not gain access to the filesystem content. There could be some tricky way to get around this, but we did not experiment with it yet. -- Balazs Ree From hedley at upfrontsystems.co.za Mon Nov 12 09:25:12 2007 From: hedley at upfrontsystems.co.za (Hedley Roos) Date: Mon, 12 Nov 2007 10:25:12 +0200 Subject: [Kss-devel] File upload when submitting a form via kss. In-Reply-To: References: <4736F275.3000609@upfrontsystems.co.za> Message-ID: <47380DE8.6040305@upfrontsystems.co.za> >> Is there anything that I can do to ensure that the form is marshaled in >> such a way that I can get a FileUpload object instead of a string? > > No. There is no way to access the content of a file from javascript. The > browsers make this sure for security reasons: so that malicious web code > could not gain access to the filesystem content. > > There could be some tricky way to get around this, but we did not > experiment with it yet. > How about some asynchronous approach? Put the in its own
. This form submits to action="store_file_in_temporary_place" Then in a Python Script invoked by kss call a custom command to submit that form which contains the file input (ie store_file_in_temporary_place will eventually fire). Your Python Script will wait for the upload to complete, and can then pick up that file wherever store_file_in_temporary_place stored it. Two catches though: 1. You'll have to increase the kss timeout of your Script (it calls a script which will presumably take a while to complete). 2. You'll have to write your own kss plugin to submit the form with the file input. But since you actually know me JC we can have a look at it :) Hedley From ree at ree.hu Mon Nov 12 11:33:32 2007 From: ree at ree.hu (Balazs Ree) Date: Mon, 12 Nov 2007 11:33:32 +0100 Subject: [Kss-devel] File upload when submitting a form via kss. References: <4736F275.3000609@upfrontsystems.co.za> <47380DE8.6040305@upfrontsystems.co.za> Message-ID: On Mon, 12 Nov 2007 10:25:12 +0200, Hedley Roos wrote: >> No. There is no way to access the content of a file from javascript. >> The browsers make this sure for security reasons: so that malicious web >> code could not gain access to the filesystem content. >> >> There could be some tricky way to get around this, but we did not >> experiment with it yet. >> >> > How about some asynchronous approach? > > Put the in its own . This form submits to > action="store_file_in_temporary_place" That's exactly the idea... to make a hidden form and use it as a normal upload. But it will not be an XMLHttpRequest, so KSS will not get any results nor be notified if it happened or not at all. So that still needs to be handled on the server somehow. Also it has to work in All Browsers which may be a challenge. > Two catches though: > 1. You'll have to increase the kss timeout of your Script (it calls a > script which will presumably take a while to complete). If needed, increasing the timeout will be the easiest bit once the whole thing works... but you may also need polling the result from the client somehow, in which case if it times out you will poll another time later, so the timeout story occurs in a different way. Keeping requests infinite long is generally a bad idea, because first the servers like apache also time out requests, and then the browsers could crash if there are lots of outgoing requests active at the same time (IE is told to work best with one or maximum two parallel requests, which is the main reason why the request handling in KSS is implemented in the way it is implemented.) > But since you actually know me JC we can have a look at it :) If you feel like experimenting with it, and maybe even target a working prototype, you are very welcome. Make sure to start with a research on the web though, there may be ideas or solutions to use (as this is a generic javascript problem, not a KSS speciality.). -- Balazs Ree From ree at ree.hu Tue Nov 13 07:30:00 2007 From: ree at ree.hu (Balazs Ree) Date: Tue, 13 Nov 2007 07:30:00 +0100 Subject: [Kss-devel] Getting rid of the KSS-log References: <4738E395.8070305@bubblenet.be> Message-ID: On Tue, 13 Nov 2007 00:36:53 +0100, Godefroid Chapelle wrote: > Malthe Borch wrote: >> Hey Godefroid, ??? >> >> Could we not have KSS in debug-mode unless the KSS-tool is in >> debug-mode? It makes it almost impossible to do js-development. >> >> \malthe > > I think it makes sense. > > What does the list think of this ? Duncan also asked for this. I agree we ahould have a second cookie and in the ui a second button: "follow/ignore tool setting" which by default should stand on "follow". I may add this soon to trunk if there are no objections. > PS : However, why do you want to do js development if not to contribute > to KSS ;-) ? There is another thing that may make sense actually. We should manage log levels from within kss and enable filtering of different log levels from the kss level. (info/debug/etc.) This could also be governed by cookies, and later by the to-be-developed kss config tool. Originally when we only had the MochiKit logger the logging level and filtering was handled by the logger itself. But now we have different loggers, and all loggers handle this differently so this does not work well any more. For example in FireBug we should not issue "debug" messages at all, they put the traceback information on the right of the line and cover important part of the message. For FireBug we should issue "info" level messages instead of "debug" and handle the info/debug level difference ourselves. Then the filtering I propose makes even more sense. Similarly each logger may require a different handling for this. -- Balazs Ree From jc at upfrontsystems.co.za Tue Nov 13 10:07:16 2007 From: jc at upfrontsystems.co.za (JC Brand) Date: Tue, 13 Nov 2007 11:07:16 +0200 Subject: [Kss-devel] File upload when submitting a form via kss. In-Reply-To: References: <4736F275.3000609@upfrontsystems.co.za> <47380DE8.6040305@upfrontsystems.co.za> Message-ID: <47396944.4060504@upfrontsystems.co.za> Balazs Ree wrote: > On Mon, 12 Nov 2007 10:25:12 +0200, Hedley Roos wrote: > >>> No. There is no way to access the content of a file from javascript. >>> The browsers make this sure for security reasons: so that malicious web >>> code could not gain access to the filesystem content. >>> >>> There could be some tricky way to get around this, but we did not >>> experiment with it yet. >>> >>> >> How about some asynchronous approach? >> But since you actually know me JC we can have a look at it :) > > If you feel like experimenting with it, and maybe even target a working > prototype, you are very welcome. Make sure to start with a research on > the web though, there may be ideas or solutions to use (as this is a > generic javascript problem, not a KSS speciality.). > Thanks for the feedback Balazs and Hedley. I'm shelving this for now, for the project I'm working on but would like to investigate it further for future projects. Hedley, I'll see you at Upfront on Friday. :) Regards JC From ree at ree.hu Tue Nov 13 10:53:42 2007 From: ree at ree.hu (Balazs Ree) Date: Tue, 13 Nov 2007 10:53:42 +0100 Subject: [Kss-devel] Getting rid of the KSS-log References: <4738E395.8070305@bubblenet.be> Message-ID: On Tue, 13 Nov 2007 07:30:00 +0100, Balazs Ree wrote: > There is another thing that may make sense actually. We should manage > log levels from within kss and enable filtering of different log levels > from the kss level. (info/debug/etc.) This could also be governed by > cookies, and later by the to-be-developed kss config tool. I issued a blueprint about this: https://blueprints.launchpad.net/kukit.js/+spec/log-level-improvements/ > Duncan also asked for this. I agree we ahould have a second cookie and > in the ui a second button: "follow/ignore tool setting" which by default > should stand on "follow". This could come sooner though, since it seems more important and does not need change in the javascript. -- Balazs Ree From massimo.azzolini at gmail.com Thu Nov 15 17:18:16 2007 From: massimo.azzolini at gmail.com (Massimo Azzolini) Date: Thu, 15 Nov 2007 17:18:16 +0100 Subject: [Kss-devel] kssdnd video Message-ID: hi all, in the last months nicola senno did a work for his thesis at the university about kss and dnd. at the naples' sprint I would show to the guy that was there what he did, but I couldn't since dnd support didn't work. now he made a video: http://it.youtube.com/watch?v=MGnSRwQuUTA In this video you can see the drag from of an object into the navigator portlet and into the news portlet. when he releases the mouse (drop) via kss he ask to the server what to do. the server replies with two different menus one for each portlet. he did two adapters one for the navportlet and one for the news one. everyone has his own logic written on the server side. I think this could be a good approach. what do you think about it? thanks massimo ps. i'm definitely late with the kss-history work.. I'm so sorry. I'm very busy in these weeks. From ree at ree.hu Fri Nov 16 08:00:44 2007 From: ree at ree.hu (Balazs Ree) Date: Fri, 16 Nov 2007 08:00:44 +0100 Subject: [Kss-devel] kssdnd video References: Message-ID: On Thu, 15 Nov 2007 17:18:16 +0100, Massimo Azzolini wrote: > in the last months nicola senno did a work for his thesis at the > university about kss and dnd. > at the naples' sprint I would show to the guy that was there what he > did, but I couldn't since dnd support didn't work. We were working to make it work, with partial success as you see later on. > now he made a video: http://it.youtube.com/watch?v=MGnSRwQuUTA > > In this video you can see the drag from of an object into the navigator > portlet and into the news portlet. when he releases the mouse (drop) via > kss he ask to the server what to do. the server replies with two > different menus one for each portlet. he did two adapters one for the > navportlet and one for the news one. everyone has his own logic written > on the server side. > > I think this could be a good approach. what do you think about it? Thanks, this is a nice video, although I find it a bit small and I get no sound with it on my machine. I can't really say anything without seeing and testing the code though, where is it? Also I have the repetitive feeling that we are suffering from communication problems. I think it would be essential at this point that Nicola comes to the mailing list himself (to this one or to plone-devel alike) and tell us about his code and experiences. Also the lack of communication is partly my mistake, so to correct this, I take the opportunity to spread some information around about the history of the kss dnd story so far: - First Godefroid and many others made a prototype dnd plugin that was based on scriptaculous and it worked in kss.demo. - Later I and Alec Mitchell made an enhanced version of the plugin that fulfilled our real life use cases, it worked on Plone 2.5 and is still running in production. It was not clean and not really public although the code is in codespeak. Alec showed it in his presentation about relations on the conference. The biggest experience of this (apart to see how extremely easy to use dnd from kss) is that the prototype library of dnd is not suitable to general purpose use from Plone, mainly because it only supported a single pool of dnd. (singleton class) And this is not sutable for generic application use. - On the sprint we targeted to port the existing plugin to Plone 3.0 and jQuery. We failed to finish this. Still I made the existing plugin work on Plone3, and I almost presented it on the second sprint day, (but the projector broke and in the end I just told about it). So the kss.plugins.sdnd does work, although it is for sure has problems. It is in the "kissbooth" project in Launchpad, and untouched since. Still it is not much use, since as I said it is unusable in Plone in its current state for anything else then prototyping. It does show though how you use the kss rule and parameters, and it does have two demos. -- Balazs Ree From massimo.azzolini at gmail.com Fri Nov 16 16:35:57 2007 From: massimo.azzolini at gmail.com (Massimo Azzolini) Date: Fri, 16 Nov 2007 16:35:57 +0100 Subject: [Kss-devel] kssdnd video In-Reply-To: References: Message-ID: balatz, On Nov 16, 2007 8:00 AM, Balazs Ree wrote: > Also I have the repetitive feeling that we are suffering from > communication problems. ouch :) > I think it would be essential at this point that > Nicola comes to the mailing list himself (to this one or to plone-devel > alike) and tell us about his code and experiences. actually he's writing his dissertation at full time, so, since he did the work in our company and we shared the basic idea, I wrote for both of us. > Also the lack of communication is partly my mistake, so to correct this, > I take the opportunity to spread some information around about the > history of the kss dnd story so far: > > [...] I read the list and I, almost, knew all of this things and all the work you and the other guys did. my phrase "dnd didn't work" wasn't intended to say "they didnt do their homework" :D you did kss(!!), you let it work in plone 3.0, chapeaux! I really dont mind if actually kss dnd didn't work. it almost worked on P3 rc3, it was enough for us for trying to implement something based on it. All the work nicola did assumes that, one day, you will release a working kssdnd and everything will automagically run. ok, ok, there will be some change to be made in .kss files, but it's easy... I was afraid since in naples I couldn't let you see what we did, so I asked nicola to create a video. I think that this could be a nice kssdnd use case, and, in addition, maybe, a possible approach to how manage the behaviour of the drop on different areas in plone. But it's all to decide, it's all to discuss and I just bring 2 cent to the discussion. about the code. Nicola told me yesterday he did some changes to the code. he sent it to me. I don't know where to share it. kissbooth? thanks for your patience... max From ree at ree.hu Fri Nov 16 17:03:53 2007 From: ree at ree.hu (Balazs Ree) Date: Fri, 16 Nov 2007 17:03:53 +0100 Subject: [Kss-devel] kssdnd video References: Message-ID: Hi Massimo, On Fri, 16 Nov 2007 16:35:57 +0100, Massimo Azzolini wrote: > On Nov 16, 2007 8:00 AM, Balazs Ree > wrote: >> I think it would be essential at this point that Nicola comes to the >> mailing list himself (to this one or to plone-devel alike) and tell us >> about his code and experiences. > > actually he's writing his dissertation at full time, so, since he did > the work in our company and we shared the basic idea, I wrote for both > of us. Ok, but still the invitation to the mailing list is on. Also you know I talk pretty good Italian, so in case English is a problem, he can feel free to contact me in private. > All the work nicola did assumes that, one day, you will release a > working kssdnd and everything will automagically run. ok, ok, there will > be some change to be made in .kss files, but it's easy... Sorry Massimo, no offense intended and I am sorry if you misunderstand the words of my previous letter. I took the chance of writing about sdnd because this is a public list and I took the opportunity to inform those who don't follow the situation as closely as you. kss.plugin.sdnd is really just a low level thing and does not compare to anything we see on the video. So saying "it works" is not to diminish Nicola's work: on the contrary. I believe that Nicola's work is very promising and I really admire that besides working on the application level he also succeeded to fix the kss wrapping _and_ the javascript part at the same time which is, I believe is an enormous success and was probably very hard to achieve. This is, one of the reasons, why I want to see the code. I'd like to see what codebase he started from and what fixes and enhancements he needed to make on the plugin level to make it work at all. The other reason is to see and undertand the application level itself. > I was afraid since in naples I couldn't let you see what we did, so I > asked nicola to create a video. > > I think that this could be a nice kssdnd use case, and, in addition, > maybe, a possible approach to how manage the behaviour of the drop on > different areas in plone. > But it's all to decide, it's all to discuss and I just bring 2 cent to > the discussion. About the application itself, I definitely think it covers a functionality that will need to be managed centrally in Plone. It will also open a discussion on both the UI design and the implementation level where I hope others will comment as well. I am more competent in the lower application level and I can only repeat that to say anything more we really need to see the code and test it ourselves. > about the code. > Nicola told me yesterday he did some changes to the code. he sent it to > me. I don't know where to share it. kissbooth? Kissbooth is a good possibility, but anywhere where it is openly accessible is fine. Best wishes, and give my regards to Nicola. -- Balazs Ree From hedley at upfrontsystems.co.za Wed Nov 21 11:13:07 2007 From: hedley at upfrontsystems.co.za (Hedley Roos) Date: Wed, 21 Nov 2007 12:13:07 +0200 Subject: [Kss-devel] Newer kss with Plone 2.5.x Message-ID: <474404B3.4090702@upfrontsystems.co.za> Is it possible to install a new kss on an older Plone? I have a specific case where kssSubmitForm would be really useful, but it is not part of PloneAzax 1.1 alpha. And a backport seems a real pain since the js code has changed a bit. H From ree at ree.hu Wed Nov 21 16:13:39 2007 From: ree at ree.hu (Balazs Ree) Date: Wed, 21 Nov 2007 16:13:39 +0100 Subject: [Kss-devel] Newer kss with Plone 2.5.x References: <474404B3.4090702@upfrontsystems.co.za> Message-ID: Hi Hedley! On Wed, 21 Nov 2007 12:13:07 +0200, Hedley Roos wrote: > Is it possible to install a new kss on an older Plone? I have a specific > case where kssSubmitForm would be really useful, but it is not part of > PloneAzax 1.1 alpha. And a backport seems a real pain since the js code > has changed a bit. The question of backport is still on the table but has not been decided yet. Basically we are all busy with other stuff. However you can create your custom plugin and backport the javascript code taken from plone.app.kss to PloneAzax or directly into ypur custom product. The javascript registration is identical between the versions. The zcml registration of plugins is little different but mainly just name changes. (Use azax:registerAction instead of kss:action and the kind.) -- Balazs Ree From massimo.azzolini at gmail.com Mon Nov 26 21:14:08 2007 From: massimo.azzolini at gmail.com (Massimo Azzolini) Date: Mon, 26 Nov 2007 21:14:08 +0100 Subject: [Kss-devel] kssdnd video In-Reply-To: References: Message-ID: Balatz On Nov 16, 2007 5:03 PM, Balazs Ree wrote: > > > > about the code. > > Nicola told me yesterday he did some changes to the code. he sent it to > > me. I don't know where to share it. kissbooth? > > Kissbooth is a good possibility, but anywhere where it is openly > accessible is fine. finally, i did it :) I put it on the collective: https://dev.plone.org/collective/browser/kssdnd/kssdnd/trunk bye max -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/kss-devel/attachments/20071126/8f330c9e/attachment-0001.htm