# HG changeset patch # User Brian Neal # Date 1324430710 0 # Node ID 311c926dd21884515bddd42b9ab12d5d9d3657f8 # Parent 645025056dfa7a4893bfcba72736f584d2858790 Must urlencode the filenames. diff -r 645025056dfa -r 311c926dd218 gpp/downloads/management/commands/dlwgetcat.py --- a/gpp/downloads/management/commands/dlwgetcat.py Wed Dec 21 01:08:21 2011 +0000 +++ b/gpp/downloads/management/commands/dlwgetcat.py Wed Dec 21 01:25:10 2011 +0000 @@ -34,8 +34,6 @@ downloads = Download.public_objects.filter(category=category).order_by( 'title').select_related() - current_site = Site.objects.get_current() - # Create new destination names for the files since the uploaders often # give the files terrible names. The new names will be slugified # versions of the titles, with the same extension. @@ -44,12 +42,10 @@ ext = os.path.splitext(dl.file.name)[1] dl.dest_filename = slugify(dl.title) + ext - # build a full URL to the download - dl.full_url = 'http://%s%s%s' % (current_site.domain, - settings.MEDIA_URL, dl.file.name) - output = render_to_string('downloads/commands/wget_cat.html', { 'downloads': downloads, + 'domain': Site.objects.get_current().domain, + 'MEDIA_URL': settings.MEDIA_URL, }) # encode it ourselves since it can fail if you try to redirect output to diff -r 645025056dfa -r 311c926dd218 gpp/templates/downloads/commands/category_report.html --- a/gpp/templates/downloads/commands/category_report.html Wed Dec 21 01:08:21 2011 +0000 +++ b/gpp/templates/downloads/commands/category_report.html Wed Dec 21 01:25:10 2011 +0000 @@ -7,7 +7,7 @@

Download Report: {{ category.title }}

{% for dl in downloads %}

{{ dl.title }}

-

Uploaded by {{ dl.user.username }}.

+

Uploaded by {{ dl.user.username }}.

{{ dl.html|safe }}
{% endfor %} diff -r 645025056dfa -r 311c926dd218 gpp/templates/downloads/commands/wget_cat.html --- a/gpp/templates/downloads/commands/wget_cat.html Wed Dec 21 01:08:21 2011 +0000 +++ b/gpp/templates/downloads/commands/wget_cat.html Wed Dec 21 01:25:10 2011 +0000 @@ -1,5 +1,5 @@ #!/bin/bash {% for dl in downloads %} -wget -O {{ dl.dest_filename }} {{ dl.full_url }} +wget -O {{ dl.dest_filename }} http://{{ domain }}{{ MEDIA_URL }}{{ dl.file.name|urlencode }} {% endfor %}