#17799 closed Bug (fixed)
Default parameters in syncdb.Command().Execute()
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Core (Management commands) | Version: | 1.4-beta-1 |
| Severity: | Normal | Keywords: | syncdb |
| Cc: | Triage Stage: | Design decision needed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Trying to run syncdb.Command().Execute() command there is an error
TypeError: int() argument must be a string or a number, not 'NoneType'
Reason: no default values specified in syncdb.handle_noargs
Fix in attach.
Attachments (2)
Change History (7)
by , 14 years ago
| Attachment: | syncdb.patch added |
|---|
comment:1 by , 14 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 14 years ago
| Triage Stage: | Accepted → Design decision needed |
|---|
comment:3 by , 14 years ago
I suddenly realized that call_command was working around this by picking defaults from klass.option_list.
# Grab out a list of defaults from the options. optparse does this for us
# when the script runs from the command line, but since call_command can
# be called programatically, we need to simulate the loading and handling
# of defaults (see #10080 for details).
Either we stick with the comment in call_command (and specifically add in the docs that execute should not be called directly):
This is the primary API you should use for calling specific commands.
Or we move the defaults value grabbing from call_command to execute (conditionally only when it is not run from command line).
This might be the real design decision to make.
See also: