[ZPT] Never mind: Getting at string module from a PT
Wade Leftwich
wade@lightlink.com
Sat, 9 Jun 2001 12:47:26 -0400
<span tal:define="global string modules/string" />
Boy, is my face red.
> -----Original Message-----
> From: Wade Leftwich [mailto:wade@lightlink.com]
> Sent: Saturday, June 09, 2001 9:43 AM
> To: zpt@zope.org
> Subject: Getting at string module from a PT
>
>
> Is there a way to import a Python module into a template?
>
> Right now, to use for example string.upper(), I make a script,
> lib/string/upper:
>
> def my_upper(s):
> import string
> if same_type(s, ''):
> return string.upper(s)
> else:
> return s
>
> return my_upper
>
> . . . which I can then grab by saying:
> <span tal:define="global upper container/lib/string/upper"/>
> <p tal:content="python:upper('foo')"/>
>
> My question is: Is there a [ better | more direct | more Pythonic
> ] way of using string.upper() in a PT?
>
>
> -- Wade Leftwich
> Ithaca, NY
>
>
>