diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-07-20 15:36:52 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-07-22 09:29:55 +0200 |
| commit | 0d914d08a0d7b5a1521f498a8047971fe6cd61e7 (patch) | |
| tree | d0ab08b0b5b2041bd796c10a26a358ae60d0914a /django/core/management/templates.py | |
| parent | bdca5ea345c548a82a80d198906818c9ccbef896 (diff) | |
[py3] Updated urllib/urllib2/urlparse imports.
Lots of functions were moved. Use explicit imports in all cases
to keey it easy to identify where the functions come from.
Diffstat (limited to 'django/core/management/templates.py')
| -rw-r--r-- | django/core/management/templates.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/django/core/management/templates.py b/django/core/management/templates.py index 623aa69deb..2bf2f661fd 100644 --- a/django/core/management/templates.py +++ b/django/core/management/templates.py @@ -8,7 +8,10 @@ import shutil import stat import sys import tempfile -import urllib +try: + from urllib.request import urlretrieve +except ImportError: # Python 2 + from urllib import urlretrieve from optparse import make_option from os import path @@ -227,8 +230,7 @@ class TemplateCommand(BaseCommand): if self.verbosity >= 2: self.stdout.write("Downloading %s\n" % display_url) try: - the_path, info = urllib.urlretrieve(url, - path.join(tempdir, filename)) + the_path, info = urlretrieve(url, path.join(tempdir, filename)) except IOError as e: raise CommandError("couldn't download URL %s to %s: %s" % (url, filename, e)) |
