Kaydet (Commit) d4733b6d authored tarafından Aymeric Augustin's avatar Aymeric Augustin

Not all Python modules have a __path__.

üst 45829933
......@@ -35,9 +35,13 @@ class AppConfig(object):
self.models = None
# Filesystem path to the application directory eg.
# u'/usr/lib/python2.7/dist-packages/django/contrib/admin'.
# This is a unicode object on Python 2 and a str on Python 3.
self.path = upath(self.app_module.__path__[0])
# u'/usr/lib/python2.7/dist-packages/django/contrib/admin'. May be
# None if the application isn't a bona fide package eg. if it's an
# egg. Otherwise it's a unicode on Python 2 and a str on Python 3.
try:
self.path = upath(self.app_module.__path__[0])
except AttributeError:
self.path = None
def __repr__(self):
return '<AppConfig: %s>' % self.label
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment