Ticket #7206: 7206.patch

File 7206.patch, 799 bytes (added by tlpinney, 7 years ago)
  • django/core/urlresolvers.py

     
    9292    Raises NoReverseMatch if the args/kwargs aren't valid for the regex.
    9393    """
    9494    # TODO: Handle nested parenthesis in the following regex.
    95     result = re.sub(r'\(([^)]+)\)', MatchChecker(args, kwargs), regex.pattern)
    96     return result.replace('^', '').replace('$', '').replace('\\', '')
     95    pattern = re.sub(r'\(\?[iLmsux]+\)','',regex.pattern)
     96    result = re.sub(r'\(([^)]+)\)', MatchChecker(args, kwargs), pattern)
     97    return result.replace('^', '').replace('$', '').replace('?','')
    9798
    9899class MatchChecker(object):
    99100    "Class used in reverse RegexURLPattern lookup."
Back to Top