#13747 closed (fixed)
Post 1.2 Development code wrongly included in 1.2 doc on Custom Management Commands
Reported by: | metamemetics | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.2 |
Severity: | Keywords: | Custom Management Commands | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
http://docs.djangoproject.com/en/1.2/howto/custom-management-commands/
The last line of the 2nd example code block is:
self.stdout.write('Successfully closed poll "%s"\n' % poll_id)
This will not work unless you are using a development repository from within the last week, or else you will get the error 'Command' object has no attribute 'stdout'. Since it is a fairly recent addition I assume it should be only in the development documentation and not the 1.2 documentation.
Change History (5)
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 14 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
IMO this feature addition should be marked as added in 1.2, since the doc says you should use it: "When you are using management commands and wish to provide console output, you should write to self.stdout and self.stderr, instead of printing to stdout and stderr directly."
comment:4 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
No, the docs really don't say that (any more). As of [13364], that text was removed from the 1.2 documentation. However, it still exists in the "dev" documentation, which reflects the current state of trunk.
comment:5 by , 14 years ago
Perhaps the anonymous re-opener meant to say it should be marked as added in 1.3? I have not checked to be sure, but it sounds like now the problem may be that reading the dev documentation there is no indication ("new in development") that this advice cannot be followed if you are running the current official release?
(In [13364]) [1.2.X] Fixed #13747 -- Reverted documentation suggesting the use of self.stdout/err in management commands in 1.2. Thanks to metamemetics for the report.
Strictly, self.stdout/err is a feature addition; however, it's a
feature that is required in order to achieve a massive speedup in the
tests and to maintain parity between 1.2.X and trunk tests. However,
the feature is completely transparent -- the old technique will work
fine, it just isn't as testable. Therefore, we'll treat this as an
undocumented feature in the 1.2 branch.