Ticket #10765: settings_folder_problem.diff

File settings_folder_problem.diff, 1.0 KB (added by vbmendes, 16 years ago)

Patch to fix the problem

  • django/utils/translation/trans_real.py

     
    127127    if settings.SETTINGS_MODULE is not None:
    128128        parts = settings.SETTINGS_MODULE.split('.')
    129129        project = import_module(parts[0])
    130         projectpath = os.path.join(os.path.dirname(project.__file__), 'locale')
     130       
     131        # If the settings module is a folder,
     132        # the projectpath must be retrieved in a different way.
     133        # Maybe it's the case of adding a constant or a function
     134        # to get this info anywhere in django.
     135        if os.path.basename(project.__file__).startswith('__init__.py'):
     136            projectpath = os.path.join(os.path.dirname(os.path.dirname(project.__file__)), 'locale')
     137        else:
     138            projectpath = os.path.join(os.path.dirname(project.__file__), 'locale')
    131139    else:
    132140        projectpath = None
    133141
Back to Top