Ticket #3221: 3221_import_error.diff

File 3221_import_error.diff, 725 bytes (added by oggie_rob, 8 years ago)

Catch ImpotError & raise ValidationError to clarify location/problem with import

  • django/core/urlresolvers.py

     
    233233                    sub_match = pattern.resolve(new_path)
    234234                except Resolver404, e:
    235235                    tried.extend([(pattern.regex.pattern + '   ' + t) for t in e.args[0]['tried']])
     236                except ImportError, e:
     237                    raise AttributeError('included urlpattern "%s" not found' % pattern.urlconf_name)
    236238                else:
    237239                    if sub_match:
    238240                        sub_match_dict = dict([(smart_str(k), v) for k, v in match.groupdict().items()])
Back to Top