Skip to content

Commit

Permalink
Not all Python modules have a __path__.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaugustin committed Dec 22, 2013
1 parent 4582993 commit d4733b6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions django/core/apps/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ def __init__(self, app_name):
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
Expand Down

0 comments on commit d4733b6

Please sign in to comment.