﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
11407	--version weirdness	Karen Tracey		"There's some weirdness that happens if you pass both --version and a subcommand, or another option, to manage.py (or django-admin.py):

{{{
kmt@lbox:~/software/web/playground$ ./manage.py --version --help
1.1 beta 1 SVN-11115
Unknown command: '--version'
Type 'manage.py help' for usage.
kmt@lbox:~/software/web/playground$ ./manage.py runserver --version
1.1 beta 1 SVN-11115
1.1 beta 1 SVN-11115
kmt@lbox:~/software/web/playground$ ./manage.py test --version
1.1 beta 1 SVN-11115
1.1 beta 1 SVN-11115
kmt@lbox:~/software/web/playground$ ./manage.py lskdjfljtest --version
1.1 beta 1 SVN-11115
Unknown command: 'lskdjfljtest'
Type 'manage.py help' for usage.
kmt@lbox:~/software/web/playground$

}}}

`--version` as provided by `optparse.OptionParser` is documented to print the version string and exit.  This is done when `parse_args` is called.  However the `LaxOptionParser` defined and used within `django.core.management.__init__` overrides `_process_args` so that the !SystemExit raised when `--version` is processed is swallowed/ignored. Thus the version gets printed but the program does not exit but rather proceeds. Things then may get a little confused depending on what else has been specified on the command line.  In the case of no subcommand the --version argument is attempted to be interpreted as a subcommand.  In the case of a valid subcommand being specified, a regular `OptionParser` is called to process the arguments for it, and that one will again print the version string but then actually exit.  In the case of an invalid subcommand, you'll get a message to that effect.  This last one actually looks like reasonable behavior but the others are a bit confusing, so it would probably be better if the program did consistently exit on the first processing of `--version`, ignoring whatever else may have been specified."	Bug	closed	Core (Management commands)	dev	Normal	fixed	management django-admin.py manage.py		Accepted	1	0	0	0	0	0
