From: Petri Lehtinen <petri.lehtinen@inoi.fi>
Date: Tue, 23 Feb 2010 16:45:51 +0200
Subject: [PATCH] Return unnamed captures from sub-URLconfs if there are no named captures.
Partially fixes #12943.
---
django/core/urlresolvers.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py
index a924afe..43725bf 100644
a
|
b
|
class RegexURLResolver(object):
|
229 | 229 | else: |
230 | 230 | if sub_match: |
231 | 231 | sub_match_dict = dict([(smart_str(k), v) for k, v in match.groupdict().items()]) |
| 232 | if not sub_match_dict: |
| 233 | sub_match_args = tuple(match.groups() + sub_match[1]) |
| 234 | else: |
| 235 | sub_match_args = () |
232 | 236 | sub_match_dict.update(self.default_kwargs) |
233 | 237 | for k, v in sub_match[2].iteritems(): |
234 | 238 | sub_match_dict[smart_str(k)] = v |
235 | | return sub_match[0], sub_match[1], sub_match_dict |
| 239 | return sub_match[0], sub_match_args, sub_match_dict |
236 | 240 | tried.append(pattern.regex.pattern) |
237 | 241 | raise Resolver404, {'tried': tried, 'path': new_path} |
238 | 242 | raise Resolver404, {'path' : path} |