#5825: Customized actions for manage.py not working
---------------------------------+------------------------------------------
Reporter:  [EMAIL PROTECTED]  |       Owner:  nobody                  
  Status:  new                   |   Component:  django-admin.py         
 Version:  SVN                   |    Keywords:  custom actions manage.py
   Stage:  Unreviewed            |   Has_patch:  0                       
---------------------------------+------------------------------------------
 Custom actions can be added, as described
 http://www.djangoproject.com/documentation/django-admin/#customized-
 actions
 Following the instructions I am getting the error message: unknown command

 To reproduce you can also copy the contents of the folder
 tests\modeltests\user_commands\management in an application subdirectory
 of your project.[[BR]]
 The regression test for user_commands passes: it seems to use a different
 sys.path than when you run manage.py from the commandline...

 Digging a bit deeper in the source file
 {{{django\core\management\__init__.py}}} :[[BR]]

 - The function imp.find_module in the method find_management_module is
 using sys.path to locate the management modules. The parent directory of
 your project is normally not on the path, so looking for an application
 package "project_name.app_name" doesn't find a module. Manage.py only has
 the project directory itself on the path.[[BR]]

 - The find_commands method in the same source file is using a pretty hack-
 ish way to discover commands: it looks for files ending in .py. This
 misses compiled code with extensions as .pyo and .pyc and also doesn't
 work for source files packaged in a zip file (as produced by eg py2exe).
 The correct api is to use pkgutil.iter_modules (unfortunately only
 available in python 2.5)[[BR]]


 (I'm willing to look at a patch for the issues, but need some guidance:
 For the first issue, I am a bit puzzled by the append and popping of the
 sys.path in the setup_environ method in the same file. For the second
 issue, it requires more changes and thinking to do it properly across
 different versions: is it worth the effort?)

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5825>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to