Description

Some core management commands are using raw "print" statements and calls to sys.stdout/sys.stderr instead of self.stdout/self.stderr. This causes an inconsistency between commands when people specify their own buffers when using django.core.management.call_command:

Change History (15)

For background -- the transition to self.stdout/stderr was done to ensure easy testing, and as a side effect, to allow Django commands to be used as a service. We've converted those commands that needed to be converted for the purpose of Django's own testing; the remainder is left as a work in progress.

I worked on a refactor of commands output using logging infrastructure, adding new BaseCommand.info() and BaseCommand.error() proxy methods, and deprecating self.stderr and self.stdout. Hopefully this is in the right direction, as of jezdez comment:5.

Just a note to any potential reviewer: as this patch is quite extensive, I will keep a local branch updated with current trunk. However, I will not spam this ticket each time I rebase my branch. So just ping me if/when you are interested to review it (hopefully during the 1.5 timeframe!)