#14087: django.core.management.get_commands only sees commands in the last 
package
of a namespace package
------------------------------+------------------------------------
     Reporter:  KyleMac       |                    Owner:  nobody
         Type:  Bug           |                   Status:  closed
    Component:  Core (Other)  |                  Version:  dev
     Severity:  Normal        |               Resolution:  fixed
     Keywords:                |             Triage Stage:  Accepted
    Has patch:  0             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+------------------------------------
Changes (by Jacob Walls):

 * has_patch:  1 => 0
 * needs_better_patch:  1 => 0
 * resolution:   => fixed
 * status:  new => closed

Comment:

 As far as I can tell, there isn't anything to fix anymore: PEP 420
 distributed namespace packages are identified just fine. (We don't use
 `imp` anymore. #21630 did that, see
 fe53bc524b9c7cbc814868acde94226d0ba2bc84.)

 A tree of namespaced packages without `__init__.py` anywhere:
 {{{
 myApps
 ├── app1
 │   ├── management
 │   │   └── commands
 │   │       ├── command1.py
 │   │       └── command2.py
 │   └── templatetags
 │       └── app1.py
 └── app2
     ├── management
     │   └── commands
     │       ├── command3.py
     │       └── command4.py
     └── templatetags
         └── app2.py

 9 directories, 6 files
 }}}

 Add `app1` and `app2` to `INSTALLED_APPS`. Then, launch Django with
 `myApps` on your path:

 {{{
 PYTHONPATH='myApps' ./manage.py
 }}}
 {{{
 [app1]
     command1
     command2

 [app2]
     command3
     command4

 ...
 }}}
 {{{
 PYTHONPATH='myApps' python3 manage.py shell
 }}}
 {{{
 In [1]: from django.template.backends.django import
 get_template_tag_modules

 In [2]: list(get_template_tag_modules())
 Out[2]:
 [
 ...
  ('app1', 'app1.templatetags.app1'),
  ('app2', 'app2.templatetags.app2')
 ]
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/14087#comment:31>
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 view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019c2516d67d-ce61a743-cdfc-4970-a046-70f6c8c24c8f-000000%40eu-central-1.amazonses.com.

Reply via email to