[ZPT] Python String Manipulation in SQL results

Philip Kilner phil at xfr.co.uk
Mon Nov 3 13:08:42 EST 2003


Hi Ian,

Ian Bicking wrote:
> On Nov 3, 2003, at 11:57 AM, Philip Kilner wrote:
> 
>> Am happily listing from the dB with: -
>>
>>     <span tal:replace="result/Email">Email goes here</span>
>>
>> What is the syntax to use Python's "rstrip" function to strip the 
>> pesky padding off the end? (Am having trouble with nesting, I think)
> 
> 
> .rstrip(), like tal:replace="python: result.Email.rstrip()", or just 
> tal:replace="result/Email/rstrip" I suppose (using TALES' 
> auto-calling).  .lstrip() and .strip() are other versions.
> 

I used: -

	tal:replace="result/Email/rstrip"

...mainly becuase it looked intuitive - it works a treat, so I will go 
away and find out about this "auto-calling" business!

Thanks, Ian!

-- 

Regards,

PhilK

Email: phil at xfr.co.uk / Voicemail & Facsimile: 07092 070518

"the symbols of the divine show up in our world initially at the trash 
stratum." Philip K Dick





More information about the ZPT mailing list