> An alternative to Text.replace would be to do a global regex substitution, 
> where the replacement pattern is a function that calls URL('static', 
> 'images/%s' % matchobj.group(0)). See the re.sub section of 
> http://docs.python.org/library/re.html for details. 
regex are too difficult for me
> But for your purposes, the code below, more or less, ought to do it.
>
>  prefix = URL('static', 'images')
>  Result = DIV(
>       H2(Book + ', ' + Chapter),
>       H3(Paragraph),
>       XML(Text.replace('src="', 'src="%s/' % prefix)
>  )
perfect,
many thanks Jonathan,
that's exactly what I'm looking for.

cheers,
Stef

Reply via email to