[Tracker-discuss] [issue127] not properly htmlizing links

Martin v. Löwis metatracker at psf.upfronthosting.co.za
Thu Aug 9 07:27:45 CEST 2007


Martin v. Löwis added the comment:

This doesn't have to be fixed before the switch, as the markup is not in the
database, but is added during rendering.

To fix it, templating.py:StringHTMLProperty.hyper_re needs to be fixed. It
currently reads

    hyper_re = re.compile(r'((?P<url>\w{3,6}://\S+)|'
                          r'(?P<email>[-+=%/\w\.]+@[\w\.\-]+)|'
                          r'(?P<item>(?P<class>[A-Za-z_]+)(\s*)(?P<id>\d+)))')

I think changing that to

    hyper_re = re.compile(r'((?P<url>\w{3,6}://\S+[\w/])|'
                          r'(?P<email>[-+=%/\w\.]+@[\w\.\-]+)|'
                          r'(?P<item>(?P<class>[A-Za-z_]+)(\s*)(?P<id>\d+)))')

should do the trick, i.e. requiring that an URL ends with a letter, digit,
underscore or slash.

----------
status: unread -> chatting

_______________________________________________________
Meta Tracker <metatracker at psf.upfronthosting.co.za>
<http://psf.upfronthosting.co.za/roundup/meta/issue127>
_______________________________________________________


More information about the Tracker-discuss mailing list