comparison downloads/management/commands/dlwgetcat.py @ 684:161b56849114

For Django 1.5: management commands should use self.stdout, etc. for output. Note that I did not update the legacy commands since it is likely I will never run or test these commands again.
author Brian Neal <bgneal@gmail.com>
date Fri, 23 Aug 2013 19:17:40 -0500
parents ee87ea74d46b
children a75554eb6bae
comparison
equal deleted inserted replaced
683:c83d330cb65f 684:161b56849114
15 15
16 16
17 class Command(LabelCommand): 17 class Command(LabelCommand):
18 help = ("Produce on standard output a bash script that wgets all the files" 18 help = ("Produce on standard output a bash script that wgets all the files"
19 " in a category. The files are downloaded with a slugified name.") 19 " in a category. The files are downloaded with a slugified name.")
20 20
21 args = "category-slug" 21 args = "category-slug"
22 22
23 def handle_label(self, slug, **options): 23 def handle_label(self, slug, **options):
24 """ 24 """
25 Render a template using the downloads in a given category and send it to 25 Render a template using the downloads in a given category and send it to
48 'MEDIA_URL': settings.MEDIA_URL, 48 'MEDIA_URL': settings.MEDIA_URL,
49 }) 49 })
50 50
51 # encode it ourselves since it can fail if you try to redirect output to 51 # encode it ourselves since it can fail if you try to redirect output to
52 # a file and any of the content is not ASCII... 52 # a file and any of the content is not ASCII...
53 print output.encode('utf-8') 53 self.stdout.write(output.encode('utf-8'))