[Zope] What wrong?
Casey Duncan
casey@zope.com
Tue, 18 Mar 2003 09:42:46 -0500
On Tuesday 18 March 2003 09:00 am, Leonardo Fernandes wrote:
> Hi,
>=20
> Please, whats wrong with this code?
>=20
> <dtml-let est=3D"_['\'./'+estagio+'/aula\'']">
> <dtml-call "RESPONSE.redirect(est)">
> </dtml-let>
_['foo']
means: "Look up the object with id 'foo'"
So Zope is trying to look up an object with the id'./Aul00/aula', which d=
oes=20
not exist. I assume this value is a path. In that case use:
<dtml-let est=3D"restrictedTraverse('%s/aula' % estagio)">
<dtml-call expr=3D"RESPONSE.redirect(est.absolute_url())">
</dtml>
However, you should not use DTML for this. A Python script would be clear=
er I=20
think such as:
est =3D context.restrictedTraverse('%s/aula' % estagio)
context.REQUEST.RESPONSE.redirect(est.absolute_url())
hth,
-Casey
>=20
> estagio is a valid variable (containing the value Aul00) and Aul00 is a=
=20
> Folder but I get the following error:
>=20
> Error type - KeyError
> Error value - './Aul00/aula'
>=20
> How would be the correct way to perform that redirection?
>=20
> Thank you very much.