Ticket #15084: django_no-app-import.2.diff

File django_no-app-import.2.diff, 895 bytes (added by jeff@…, 14 years ago)

Tested, working fix - derp, other one was always trying to find a module called "app"

  • django/utils/translation/trans_real.py

    diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
    index a5c612b..d9eb649 100644
    a b import sys  
    77import warnings
    88import gettext as gettext_module
    99from cStringIO import StringIO
     10import pkgutil
    1011
    1112from django.utils.importlib import import_module
    1213from django.utils.safestring import mark_safe, SafeData
    def translation(language):  
    163164                res = _merge(localepath)
    164165
    165166        for appname in settings.INSTALLED_APPS:
    166             app = import_module(appname)
    167             apppath = os.path.join(os.path.dirname(app.__file__), 'locale')
     167            app = pkgutil.get_loader(appname)
     168            apppath = os.path.join(app.filename, 'locale')
    168169
    169170            if os.path.isdir(apppath):
    170171                res = _merge(apppath)
Back to Top