~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

Viewing changes to django/contrib/staticfiles/management/commands/findstatic.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone
  • Date: 2013-11-07 15:33:49 UTC
  • mfrom: (1.3.12)
  • Revision ID: package-import@ubuntu.com-20131107153349-e31sc149l2szs3jb
Tags: 1.6-1
* New upstream version. Closes: #557474, #724637.
* python-django now also suggests the installation of ipython,
  bpython, python-django-doc, and libgdal1.
  Closes: #636511, #686333, #704203
* Set package maintainer to Debian Python Modules Team.
* Bump standards version to 3.9.5, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import os
4
4
from optparse import make_option
5
5
from django.core.management.base import LabelCommand
6
 
from django.utils.encoding import smart_text
 
6
from django.utils.encoding import force_text
7
7
 
8
8
from django.contrib.staticfiles import finders
9
9
 
19
19
    def handle_label(self, path, **options):
20
20
        verbosity = int(options.get('verbosity', 1))
21
21
        result = finders.find(path, all=options['all'])
22
 
        path = smart_text(path)
 
22
        path = force_text(path)
23
23
        if result:
24
24
            if not isinstance(result, (list, tuple)):
25
25
                result = [result]
26
 
            output = '\n  '.join(
27
 
                (smart_text(os.path.realpath(path)) for path in result))
28
 
            self.stdout.write("Found '%s' here:\n  %s" % (path, output))
 
26
            result = (force_text(os.path.realpath(path)) for path in result)
 
27
            if verbosity >= 1:
 
28
                output = '\n  '.join(result)
 
29
                return "Found '%s' here:\n  %s" % (path, output)
 
30
            else:
 
31
                return '\n'.join(result)
29
32
        else:
30
33
            if verbosity >= 1:
31
34
                self.stderr.write("No matching file found for '%s'." % path)