Tiago Cogumbreiro

O Irrepupável

Back to top

Wednesday, April 01, 2009

Redirecting to an external link/URL in Zope (and Plone)

Go to the Zope Management Interface. In Plone click on Site Setup (on the upper left corner) and then under Plone Configuration click on Zope Management Interface.

Next, create a content Script (Python) (select it in the drop-down widget in the upper left corner of the page). Select the name of the link of the origin of the redirection and click on Add and Edit.

Add the following content:

# Import a standard function, and get the HTML request and response objects.
from Products.PythonScripts.standard import html_quote
request = container.REQUEST
RESPONSE = request.RESPONSE

#return context.REQUEST.RESPONSE.redirect("http://www.google.com/")
return RESPONSE.redirect("http://www.google.com/")

This will redirect http://YOURHOSTNAME/foo (if you create the python script at the root of your Zope Management Interface named foo) and redirect it to http://www.google.com/. Could be easier (and fully accessible trough Plone's UI).

0 comments: