  """
  Unit tests for reverse URL lookups.
  """
  from django.conf import settings
  from django.core.exceptions import ImproperlyConfigured
  from django.core.urlresolvers import reverse, resolve, NoReverseMatch,\
                                       Resolver404, ResolverMatch,\
                                       RegexURLResolver, RegexURLPattern
  from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect
  from django.shortcuts import redirect
 
</s> remove         try:
            return get_callable(callback), {}
        except (ImportError, AttributeError), e:
            raise ViewDoesNotExist("Tried %s. Error was: %s" % (callback, str(e)))
 </s> add         return get_callable(callback), {} </s> remove             # Bail early for non-ASCII strings (they can't be functions).
            lookup_view = lookup_view.encode('ascii')
            mod_name, func_name = get_mod_func(lookup_view)
 </s> add  </s> remove                     raise AttributeError("'%s.%s' is not a callable." % (mod_name, func_name))
        except (ImportError, AttributeError):
 </s> add                     raise ViewDoesNotExist(
                        "Could not import %s.%s. View is not callable."
                    % (mod_name, func_name))
        except AttributeError:
            if not can_fail:
                raise ViewDoesNotExist(
                    "Could not import %s. View does not exist in module %s."
                    % (lookup_view, mod_name))
        except ImportError:
            ownermod, submod = get_mod_func(mod_name)
            if (not can_fail and submod != '' and
                    not module_has_submodule(import_module(ownermod), submod)):
                raise ViewDoesNotExist(
                    "Could not import %s. Owning module %s does not exist."
                    % (lookup_view, mod_name))
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
  """
  Unit tests for reverse URL lookups.
  """
  from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
  from django.core.urlresolvers import reverse, resolve, NoReverseMatch,\
                                       Resolver404, ResolverMatch,\
                                       RegexURLResolver, RegexURLPattern
  from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect
  from django.shortcuts import redirect
keep keep keep keep replace keep keep keep keep keep
 Fixed #10802 -- Handle ImportErrors and AttributeErrors gracefully when raised by the URL resolver system during startup. Many thanks, IonelMaries and Bas Peschier.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16420 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
tests/regressiontests/urlpatterns_reverse/tests.py