[Kss-devel] kss and response.redirect

Radim Novotny novotny.radim at gmail.com
Tue Nov 6 06:53:40 CET 2007


There is plone-followLink command available (which actually sets 
window.location), so you can define hidden, empty <a href="#" 
id="somelink"> 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.



More information about the Kss-devel mailing list