[ZPT] fixed url, or how to find python script

Wolfgang Klinger wolfgang@wazum.com
11 Apr 2002 08:08:23 +0200


hiya!

when you use the python: expression syntax you have to "call"
scripts ...

you can define a variable and use it later
<td tal:define=3D"bhref python:base_href_py()" ...>

but your example won't work, 'cause base_href_py is just
a string and not an object ...
try to get the root "object" or whatever you need and use
this in your path

Wolfgang
=20
On Wed, 2002-04-10 at 23:15, Call Me Audrey wrote:
> how to make a fixed url (like for a constant-but-modular header) using zp=
t=20
> and macros? or, how to reference the python script that contains the fixe=
d=20
> url? i tried:
>=20
> <div metal:fill-slot=3D"header">
> <td tal:repeat=3D"item python:base_href_py/container/objectValues"
> height=3D"26" align=3D"center"><a href=3D"" tal:attributes=3D"href item">
> <span tal:replace=3D"item/title">header link</span></a></td>
> </div>
>=20
> with Python script "base_href_py" in same folder as index_html:
> ##
> address =3D "http://[...]/"
> print address
> return printed
> ##
>=20
> produces error: "Error Type: TALESError
>         Error Value: exceptions.NameError on global name 'base_href_py' i=
s=20
> not defined in '', at line 11, column 1"
> why is it not defined? (it's RIGHT there! grrr...)
>=20
> thanks for any input.
> audrey
>=20
>=20
>=20
>=20
> .........=B7.=B7?=B7.=B7=BF.
>=20
> ......=B7.=BF=B7?.=B7.=B7..?.=B7.=BF
>=20
> ..=BF=B7?.=BF.Call Me Audrey=B7?.=B7.?
>=20
> ....?.=B7.=BF=B7?.=B7.=B7=BF?.=B7.=BF.=B7.=BF
>=20
> .=B7=BF.www.crouchingbitches.com.=B7=BF
>=20
> ........?.=B7.=BF=B7.?.=B7.=BF.
>=20
> =BF=B7?.=BF...718.387.8591=B7?.=B7.?
>=20
> ....=B7.=BF=B7?.=B7.=BF=B7?.=B7.=B7=BF?.=B7.=BF.
>=20
> ...........=B7.=BF.=B7.=B7?.
>=20
>=20
>=20
>=20
>=20
>=20
>=20
>=20
>=20
>=20
> _________________________________________________________________
> Join the world=92s largest e-mail service with MSN Hotmail.=20
> http://www.hotmail.com
>=20
>=20
>=20
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://lists.zope.org/mailman/listinfo/zpt