#25515 closed Bug (fixed)
The return value of BaseCommand.handle() is treated as output, but this is undocumented
Reported by: | Ned Batchelder | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | rene@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The docs for handle() (https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/#django.core.management.BaseCommand.handle) don't mention what its return value means.
The code treats it as output, and writes it to self.stdout(). This should be documented.
(Note: the behavior changed slightly between 1.4 and 1.8: In 1.4, we returned a binary string, and it worked fine, in 1.8, this fails with a DecodeError because of "results.endswith(ending)" ).
Change History (6)
comment:1 by , 9 years ago
Cc: | added |
---|
comment:2 by , 9 years ago
Has patch: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 9 years ago
Even better: mention that it's a Unicode string. I stumbled on all this due to a UnicodeDecodeError from a bytestring being returned.
Good enough?
docs/howto/custom-management-commands.txt