#11911: urlizetrunc not taking into account last ')' of a link
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
Stefan_Petrea | Status: new
Type: Bug | Component: Template system
Milestone: 1.4 | Severity: Normal
Version: SVN | Keywords: urlizetrunc
Resolution: | Has patch: 1
Triage Stage: Design | Needs tests: 0
decision needed | Easy pickings: 0
Needs documentation: 0 |
Patch needs improvement: 1 |
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by trez):
* needs_better_patch: 0 => 1
* ui_ux: => 0
* stage: Accepted => Design decision needed
Comment:
It seems than the real problem come from the definition of punctuation_re:
{{{
TRAILING_PUNCTUATION = ['.', ',', ')', '>', '\n', '>']
punctuation_re =
re.compile('^(?P<lead>(?:%s)*)(?P<middle>.*?)(?P<trail>(?:%s)*)$' % \
('|'.join([re.escape(x) for x in LEADING_PUNCTUATION]),
'|'.join([re.escape(x) for x in TRAILING_PUNCTUATION])))
}}}
The ')' character is not interpreted as a part of the url but as an
enclosing character.
The patch provided solve the parenthesis problem but do not solve other
cases for other unreserved characters in the TRAILING_PUNCTUATION list.
Valid character accoding to RFC 1738 named as extra are "!" | "*" | "'" |
"(" | ")" | ","
For example: http://en.wikipedia.org/wiki/Sibiu(Romania). which is the
valid (notice the dot at the end of the url)
To completely solve this problem, I think an in-depth rewrite of the
punctation_re should be done which should be able to distinguish between
http://en.wikipedia.org/wiki/Sibiu(Romania) and
(http://en.wikipedia.org/wiki/Sibiu(Romania))
A design decision is needed.
--
Ticket URL: <https://code.djangoproject.com/ticket/11911#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.