#24403: makemessages when run for a django app and no settings will fail on
settings.STATIC_ROOT and settings.MEDIA_ROOT not being set
--------------------------------------------+-----------------------
     Reporter:  silkentrance                |      Owner:  nobody
         Type:  Bug                         |     Status:  new
    Component:  Core (Management commands)  |    Version:  1.8alpha1
     Severity:  Normal                      |   Keywords:
 Triage Stage:  Unreviewed                  |  Has patch:  0
Easy pickings:  0                           |      UI/UX:  0
--------------------------------------------+-----------------------
 In management/commands/makemessages.py it reads in line 375

 {{{
 ignored_roots = [os.path.normpath(p) for p in (settings.MEDIA_ROOT,
 settings.STATIC_ROOT)]
 }}}

 This will fail in situations where there is no STATIC_ROOT a/o MEDIA_ROOT,
 in which case ignored_roots will be populated with None, causing the
 subsequent path operation os.normpath(p) to fail.

 This in turn will prevent users from generating the po files for django
 apps that do not have any such settings.

 In order to fix this, the following code seems to work quite well

 {{{
 375         ignored_roots = []
 376         if settings.MEDIA_ROOT:
 377             ignored_roots.extend([os.path.normpath(p) for p in
 settings.MEDIA_ROOT])
 378         if settings.STATIC_ROOT:
 379             ignored_roots.extend([os.path.normpath(p) for p in
 settings.STATIC_ROOT])
 }}}


 ----

 I am using Django 1.8 installed via PyPi

 {{{
 # pip2 show django
 ---
 Name: Django
 Version: 1.8.dev20141027110112
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24403>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/055.d424f2d681376378894675558bac9ca5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to