Avoided %r formatting on possibly unicode strings.
The u prefix looks bad on Python 2.
This commit is contained in:
parent
efddae252c
commit
14bcbd9937
|
@ -83,13 +83,13 @@ class AppConfig(object):
|
|||
# would raise when <mod_path> exists but not <cls_name>, with
|
||||
# more context (Python just says "cannot import name ...").
|
||||
raise ImportError(
|
||||
"cannot import name %r from %r" % (cls_name, mod_path))
|
||||
"cannot import name '%s' from '%s'" % (cls_name, mod_path))
|
||||
|
||||
# Check for obvious errors. (This check prevents duck typing, but
|
||||
# it could be removed if it became a problem in practice.)
|
||||
if not issubclass(cls, AppConfig):
|
||||
raise ImproperlyConfigured(
|
||||
"%r isn't a subclass of AppConfig." % entry)
|
||||
"'%s' isn't a subclass of AppConfig." % entry)
|
||||
|
||||
# Obtain app name here rather than in AppClass.__init__ to keep
|
||||
# all error checking for entries in INSTALLED_APPS in one place.
|
||||
|
@ -97,7 +97,7 @@ class AppConfig(object):
|
|||
app_name = cls.name
|
||||
except AttributeError:
|
||||
raise ImproperlyConfigured(
|
||||
"%r must supply a name attribute." % entry)
|
||||
"'%s' must supply a name attribute." % entry)
|
||||
|
||||
# Ensure app_names points to a valid module.
|
||||
app_module = import_module(app_name)
|
||||
|
|
|
@ -181,9 +181,9 @@ class Apps(object):
|
|||
|
||||
app_config = self.app_configs.get(app_label)
|
||||
if app_config is None:
|
||||
raise LookupError("No installed app with label %r." % app_label)
|
||||
raise LookupError("No installed app with label '%s'." % app_label)
|
||||
if only_with_models_module and app_config.models_module is None:
|
||||
raise LookupError("App with label %r doesn't have a models module." % app_label)
|
||||
raise LookupError("App with label '%s' doesn't have a models module." % app_label)
|
||||
return app_config
|
||||
|
||||
# This method is performance-critical at least for Django's test suite.
|
||||
|
|
Loading…
Reference in New Issue