Code

Ticket #5140: url_template_tag_raises_exception_on_invalid_path.patch

File url_template_tag_raises_exception_on_invalid_path.patch, 1.0 KB (added by oliver.andrich@…, 7 years ago)

A newbies patch for this ticket.

Line 
1*** django/template/defaulttags.py.ORIG 2007-08-12 17:02:50.000000000 +0200
2--- django/template/defaulttags.py      2007-08-12 17:04:38.000000000 +0200
3***************
4*** 342,352 ****
5          try:
6              return reverse(self.view_name, args=args, kwargs=kwargs)
7          except NoReverseMatch:
8!             try:
9!                 project_name = settings.SETTINGS_MODULE.split('.')[0]
10!                 return reverse(project_name + '.' + self.view_name, args=args, kwargs=kwargs)
11!             except NoReverseMatch:
12!                 return ''
13 
14  class WidthRatioNode(Node):
15      def __init__(self, val_expr, max_expr, max_width):
16--- 342,349 ----
17          try:
18              return reverse(self.view_name, args=args, kwargs=kwargs)
19          except NoReverseMatch:
20!             project_name = settings.SETTINGS_MODULE.split('.')[0]
21!             return reverse(project_name + '.' + self.view_name, args=args, kwargs=kwargs)
22 
23  class WidthRatioNode(Node):
24      def __init__(self, val_expr, max_expr, max_width):