Not all Python modules have a __path__.
This commit is contained in:
parent
4582993302
commit
d4733b6df0
|
@ -35,9 +35,13 @@ class AppConfig(object):
|
||||||
self.models = None
|
self.models = None
|
||||||
|
|
||||||
# Filesystem path to the application directory eg.
|
# Filesystem path to the application directory eg.
|
||||||
# u'/usr/lib/python2.7/dist-packages/django/contrib/admin'.
|
# u'/usr/lib/python2.7/dist-packages/django/contrib/admin'. May be
|
||||||
# This is a unicode object on Python 2 and a str on Python 3.
|
# 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])
|
self.path = upath(self.app_module.__path__[0])
|
||||||
|
except AttributeError:
|
||||||
|
self.path = None
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<AppConfig: %s>' % self.label
|
return '<AppConfig: %s>' % self.label
|
||||||
|
|
Loading…
Reference in New Issue