Maybe something like: class MYIMG(IMG): def __init__(self, *components, **attributes): if '_src' in attributes: attributes['_src'] = mangle(attributes['_src']) return super(MYIMG, self).__init__(*components, **attributes)
Then you can do: MYIMG(_src=URL('static', 'someimage.jpg')) and the _src URL will be altered automatically. Anthony On Tuesday, August 21, 2012 11:36:18 AM UTC-4, AngeloC wrote: > > Hi guys, > > Any advice on howto extend IMG to preprocess url? I simply want to mangle > url before it passed to IMG and this should be done every time an IMG tag > is used. > > Thanks! > > -- > Profile: http://it.linkedin.com/in/compagnucciangelo > --