diff options
author | Danilo Segan <danilo@canonical.com> | 2012-07-11 13:56:10 +0200 |
---|---|---|
committer | Danilo Segan <danilo@canonical.com> | 2012-07-11 13:56:10 +0200 |
commit | 16b167b6418a8b086bc89f210aef7c73c7c16b39 (patch) | |
tree | da86e6d98a1555aee71ba0420931ea7737bc5c43 | |
parent | d9f4eff4a60e24a2071bf72f4f9b523a438578d5 (diff) |
Lint fixes.
-rw-r--r-- | license_protected_downloads/buildinfo.py | 34 | ||||
-rw-r--r-- | license_protected_downloads/models.py | 1 | ||||
-rw-r--r-- | license_protected_downloads/tests/__init__.py | 12 | ||||
-rw-r--r-- | license_protected_downloads/tests/test_buildinfo.py | 51 | ||||
-rw-r--r-- | license_protected_downloads/tests/test_pep8.py | 40 | ||||
-rw-r--r-- | license_protected_downloads/tests/test_pyflakes.py | 32 | ||||
-rw-r--r-- | license_protected_downloads/tests/test_views.py | 14 | ||||
-rw-r--r-- | license_protected_downloads/views.py | 21 | ||||
-rw-r--r-- | manage.py | 8 | ||||
-rw-r--r-- | settings.py | 32 | ||||
-rw-r--r-- | testplans/__init__.py | 1 | ||||
-rw-r--r-- | tests/__init__.py | 2 | ||||
-rw-r--r-- | tests/license_protected_file_downloader.py | 4 | ||||
-rw-r--r-- | tests/test_click_through_license.py | 1 | ||||
-rw-r--r-- | tests/test_publish_to_snapshots.py | 4 | ||||
-rw-r--r-- | urls.py | 12 |
16 files changed, 191 insertions, 78 deletions
diff --git a/license_protected_downloads/buildinfo.py b/license_protected_downloads/buildinfo.py index e961949..128c109 100644 --- a/license_protected_downloads/buildinfo.py +++ b/license_protected_downloads/buildinfo.py @@ -1,19 +1,21 @@ import os -import glob +import fnmatch class IncorrectDataFormatException(Exception): ''' Build-info data is in incorrect format. ''' + class BuildInfo: def __init__(self, fn): self.index = 0 self.lines = [] self.build_info_array = [{}] self.file_info_array = [{}] - self.fields_defined = ["format-version", "files-pattern", - "build-name", "theme", "license-type", "openid-launchpad-teams", - "collect-user-data", "license-text"] + self.fields_defined = [ + "format-version", "files-pattern", "build-name", "theme", + "license-type", "openid-launchpad-teams", "collect-user-data", + "license-text"] self.full_file_name = fn self.search_path = self.get_search_path(fn) self.fname = os.path.basename(fn) @@ -24,7 +26,6 @@ class BuildInfo: self.remove_false_positives() self.max_index = len(self.file_info_array) - @classmethod def get_search_path(cls, path): "Return BUILD-INFO.txt search path for a given filesystem path." @@ -32,12 +33,11 @@ class BuildInfo: path = os.path.dirname(path) return path - @classmethod def build_info_exists(cls, path): "Check if BUILD-INFO.txt exists for a given filesystem path." - return os.path.exists(os.path.join(cls.get_search_path(path), "BUILD-INFO.txt")) - + return os.path.exists( + os.path.join(cls.get_search_path(path), "BUILD-INFO.txt")) def _set(self, key, value): key = key.lower() @@ -63,10 +63,9 @@ class BuildInfo: # Special handling of entire-directory access specifier if key == "*" and os.path.isdir(self.full_file_name): return block[key] - files = glob.glob(os.path.join(self.search_path, key)) - for filename in files: - if filename == self.full_file_name: - return block[key] + if fnmatch.fnmatch(self.full_file_name, + os.path.join(self.search_path, key)): + return block[key] return [{}] def getFormatVersion(self): @@ -86,16 +85,18 @@ class BuildInfo: if field == key: return block[field] return False - + def parseLine(self, line): values = line.split(":", 1) if len(values) != 2: - raise IncorrectDataFormatException("'%s': Line is not in the correct format." % line) + raise IncorrectDataFormatException( + "'%s': Line is not in the correct format." % line) else: field = values[0].strip().lower() value = values[1].strip() if not self.isValidField(field): - raise IncorrectDataFormatException("Field '%s' not allowed." % field) + raise IncorrectDataFormatException( + "Field '%s' not allowed." % field) else: return {field: value} @@ -111,7 +112,8 @@ class BuildInfo: format_line = lines.pop(0) values = self.parseLine(format_line) if not "format-version" in values: - raise IncorrectDataFormatException("Format-Version field not found.") + raise IncorrectDataFormatException( + "Format-Version field not found.") self._set("format-version", values["format-version"]) self.line_no = 0 diff --git a/license_protected_downloads/models.py b/license_protected_downloads/models.py index bfb4961..d95a964 100644 --- a/license_protected_downloads/models.py +++ b/license_protected_downloads/models.py @@ -1,5 +1,6 @@ from django.db import models + class License(models.Model): digest = models.CharField(max_length=40) text = models.TextField() diff --git a/license_protected_downloads/tests/__init__.py b/license_protected_downloads/tests/__init__.py index 04bf1eb..3c2e68d 100644 --- a/license_protected_downloads/tests/__init__.py +++ b/license_protected_downloads/tests/__init__.py @@ -1,10 +1,14 @@ -from license_protected_downloads.tests.test_models import * -from license_protected_downloads.tests.test_views import * -from license_protected_downloads.tests.test_buildinfo import * +from license_protected_downloads.tests.test_buildinfo import BuildInfoTests +from license_protected_downloads.tests.test_models import LicenseTestCase +from license_protected_downloads.tests.test_pep8 import TestPep8 +from license_protected_downloads.tests.test_pyflakes import TestPyflakes +from license_protected_downloads.tests.test_views import ViewTests #starts the test suite -__test__= { +__test__ = { 'LicenseTestCase': LicenseTestCase, 'ViewTests': ViewTests, 'BuildInfoTests': BuildInfoTests, + 'TestPep8': TestPep8, + 'TestPyflakes': TestPyflakes, } diff --git a/license_protected_downloads/tests/test_buildinfo.py b/license_protected_downloads/tests/test_buildinfo.py index f315529..80228e7 100644 --- a/license_protected_downloads/tests/test_buildinfo.py +++ b/license_protected_downloads/tests/test_buildinfo.py @@ -12,14 +12,14 @@ class BuildInfoTests(unittest.TestCase): def setUp(self): self.buildinfo_file_path = os.path.join(THIS_DIRECTORY, "BUILD-INFO.txt") - + def test_readFile_nonFile(self): with self.assertRaises(IOError): - build_info = BuildInfo("license_protected_downloads") + BuildInfo("license_protected_downloads") def test_readFile_nonexistentFile(self): with self.assertRaises(IOError): - build_info = BuildInfo("nonexistent.file") + BuildInfo("nonexistent.file") def test_readFile_File(self): build_info = BuildInfo(self.buildinfo_file_path) @@ -58,13 +58,15 @@ class BuildInfoTests(unittest.TestCase): line = "Build-Name:value" build_info = BuildInfo(self.buildinfo_file_path) - self.assertDictEqual({"build-name":"value"}, build_info.parseLine(line)) + self.assertDictEqual({"build-name": "value"}, + build_info.parseLine(line)) def test_parseLine_trims(self): line = "Build-Name: value" build_info = BuildInfo(self.buildinfo_file_path) - self.assertDictEqual({"build-name":"value"}, build_info.parseLine(line)) + self.assertDictEqual({"build-name": "value"}, + build_info.parseLine(line)) def test_parseLine_invalid_field(self): line = "field: value" @@ -82,8 +84,11 @@ class BuildInfoTests(unittest.TestCase): def test_parseData_blocks(self): build_info = BuildInfo(self.buildinfo_file_path) build_info.build_info_array = [{}] - data = ["Format-Version: 2.0", "Files-Pattern: *.txt", "Build-Name: weehee", - "Files-Pattern: *.tgz", "Build-Name: woohoo"] + data = ["Format-Version: 2.0", + "Files-Pattern: *.txt", + "Build-Name: weehee", + "Files-Pattern: *.tgz", + "Build-Name: woohoo"] build_info.parseData(data) self.assertEquals(build_info.build_info_array, @@ -94,7 +99,8 @@ class BuildInfoTests(unittest.TestCase): def test_parseData_block_multiple_patterns(self): build_info = BuildInfo(self.buildinfo_file_path) build_info.build_info_array = [{}] - data = ["Format-Version: 2.0", "Files-Pattern: *.txt,*.tgz", + data = ["Format-Version: 2.0", + "Files-Pattern: *.txt,*.tgz", "Build-Name: weehee"] build_info.parseData(data) @@ -113,7 +119,8 @@ class BuildInfoTests(unittest.TestCase): build_info = BuildInfo(self.buildinfo_file_path) build_info.line_no = 0 - self.assertEquals("", build_info.parseContinuation(["no-space", " space"])) + self.assertEquals("", + build_info.parseContinuation(["no-space", " space"])) def test_parseContinuation(self): build_info = BuildInfo(self.buildinfo_file_path) @@ -135,7 +142,9 @@ class BuildInfoTests(unittest.TestCase): def test_parseData_extra_fields(self): build_info = BuildInfo(self.buildinfo_file_path) build_info.build_info_array = [{}] - data = ["Format-Version: 2.0", "Files-Pattern: *.txt", "Build-Name: woohoo"] + data = ["Format-Version: 2.0", + "Files-Pattern: *.txt", + "Build-Name: woohoo"] build_info.parseData(data) self.assertEqual(build_info.build_info_array, @@ -182,8 +191,11 @@ class BuildInfoTests(unittest.TestCase): build_info = BuildInfo(self.buildinfo_file_path) build_info.build_info_array = [{}] build_info.file_info_array = [{}] - data = ["Format-Version: 2.0", "Files-Pattern: *.txt", "License-Type: protected", - "Files-Pattern: *.txt", "License-Type: open"] + data = ["Format-Version: 2.0", + "Files-Pattern: *.txt", + "License-Type: protected", + "Files-Pattern: *.txt", + "License-Type: open"] build_info.parseData(data) build_info.file_info_array = build_info.getInfoForFile() build_info.remove_false_positives() @@ -195,8 +207,11 @@ class BuildInfoTests(unittest.TestCase): build_info = BuildInfo(self.buildinfo_file_path) build_info.build_info_array = [{}] build_info.file_info_array = [{}] - data = ["Format-Version: 2.0", "Files-Pattern: *.txt", "License-Type: protected", - "Files-Pattern: *.txt", "License-Type: protected"] + data = ["Format-Version: 2.0", + "Files-Pattern: *.txt", + "License-Type: protected", + "Files-Pattern: *.txt", + "License-Type: protected"] build_info.parseData(data) build_info.file_info_array = build_info.getInfoForFile() build_info.remove_false_positives() @@ -219,7 +234,9 @@ class BuildInfoTests(unittest.TestCase): build_info.full_file_name = file_path build_info.build_info_array = [{}] build_info.file_info_array = [{}] - data = ["Format-Version: 2.0", "Files-Pattern: *.txt", "License-Type: protected"] + data = ["Format-Version: 2.0", + "Files-Pattern: *.txt", + "License-Type: protected"] build_info.parseData(data) build_info.file_info_array = build_info.getInfoForFile() @@ -246,7 +263,9 @@ class BuildInfoTests(unittest.TestCase): build_info.full_file_name = file_path build_info.build_info_array = [{}] build_info.file_info_array = [{}] - data = ["Format-Version: 2.0", "Files-Pattern: *.txt", "License-Type: protected"] + data = ["Format-Version: 2.0", + "Files-Pattern: *.txt", + "License-Type: protected"] build_info.parseData(data) build_info.file_info_array = build_info.getInfoForFile() build_info.remove_false_positives() diff --git a/license_protected_downloads/tests/test_pep8.py b/license_protected_downloads/tests/test_pep8.py new file mode 100644 index 0000000..3877d85 --- /dev/null +++ b/license_protected_downloads/tests/test_pep8.py @@ -0,0 +1,40 @@ +# Copyright (C) 2012 Linaro Ltd. +# +# Author: Loic Minier <loic.minier@linaro.org> +# +# This file is part of Linaro Image Tools. +# +# Linaro Image Tools is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Linaro Image Tools is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import subprocess +from testtools import TestCase + + +class TestPep8(TestCase): + def test_pep8(self): + # Errors we have to ignore for now: + # * E202 whitespace before ')' or ']' + # E202 is actually only reported with the natty version of pep8 and + # can be re-enabled once we drop support for natty. + ignore = ['E202'] + # Ignore return code. + proc = subprocess.Popen(['pep8', + '--repeat', + '--ignore=%s' % ','.join(ignore), + '.'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + (stdout, stderr) = proc.communicate() + self.assertEquals('', stdout) + self.assertEquals('', stderr) diff --git a/license_protected_downloads/tests/test_pyflakes.py b/license_protected_downloads/tests/test_pyflakes.py new file mode 100644 index 0000000..b7eadbe --- /dev/null +++ b/license_protected_downloads/tests/test_pyflakes.py @@ -0,0 +1,32 @@ +# Copyright (C) 2011 Linaro +# +# Author: Loic Minier <loic.minier@linaro.org> +# +# This file is part of Linaro Image Tools. +# +# Linaro Image Tools is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Linaro Image Tools is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import subprocess +from testtools import TestCase + + +class TestPyflakes(TestCase): + def test_pyflakes(self): + # ignore return code + proc = subprocess.Popen(['pyflakes', '.'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + (stdout, stderr) = proc.communicate() + self.assertEquals('', stdout) + self.assertEquals('', stderr) diff --git a/license_protected_downloads/tests/test_views.py b/license_protected_downloads/tests/test_views.py index 68d3f28..d945a1d 100644 --- a/license_protected_downloads/tests/test_views.py +++ b/license_protected_downloads/tests/test_views.py @@ -1,19 +1,19 @@ -import re -import urlparse -from license_protected_downloads.views import _insert_license_into_db - __author__ = 'dooferlad' +from django.conf import settings +from django.test import Client, TestCase +import hashlib import os import unittest -import hashlib -from django.test import Client, TestCase +import urlparse + from license_protected_downloads.buildinfo import BuildInfo -from django.conf import settings +from license_protected_downloads.views import _insert_license_into_db THIS_DIRECTORY = os.path.dirname(os.path.abspath(__file__)) TESTSERVER_ROOT = os.path.join(THIS_DIRECTORY, "testserver_root") + class ViewTests(TestCase): def setUp(self): self.client = Client() diff --git a/license_protected_downloads/views.py b/license_protected_downloads/views.py index 37c1ef4..9499c7b 100644 --- a/license_protected_downloads/views.py +++ b/license_protected_downloads/views.py @@ -19,6 +19,7 @@ from django.template import RequestContext import mimetypes import glob + def _hidden_file(file_name): hidden_files = ["BUILD-INFO.txt", "EULA.txt", ".htaccess", "HEADER.html"] for pattern in hidden_files: @@ -26,6 +27,7 @@ def _hidden_file(file_name): return True return False + def _hidden_dir(file_name): hidden_files = [".*openid.*", ".*restricted.*", ".*private.*"] for pattern in hidden_files: @@ -33,6 +35,7 @@ def _hidden_dir(file_name): return True return False + def dir_list(url, path): files = os.listdir(path) files.sort() @@ -57,7 +60,7 @@ def dir_list(url, path): size = os.path.getsize(file) if not re.search(r'^/', url) and url != '': - url = '/' + url + url = '/' + url listing.append({'name': name, 'size': size, 'type': type, @@ -65,6 +68,7 @@ def dir_list(url, path): 'url': url + '/' + name}) return listing + def test_path(path): for basepath in settings.SERVED_PATHS: @@ -76,20 +80,24 @@ def test_path(path): return None + def _insert_license_into_db(digest, text, theme): if not License.objects.filter(digest=digest): l = License(digest=digest, text=text, theme=theme) l.save() + def _check_special_eula(path): if glob.glob(path + ".EULA.txt.*"): return True + def _get_theme(path): eula = glob.glob(path + ".EULA.txt.*") vendor = os.path.splitext(eula[0])[1] return vendor[1:] + def is_protected(path): build_info = None max_index = 1 @@ -151,9 +159,11 @@ def is_protected(path): return digests + def license_accepted(request, digest): return 'license_accepted_' + digest in request.COOKIES + def accept_license(request): if "accept" in request.POST: lic = License.objects.filter(digest=request.GET['lic']).get() @@ -163,14 +173,16 @@ def accept_license(request): "?dl=/" + file_url) d = lic.digest cookie_name = "license_accepted_" + d.encode("ascii") + # Set a cookie with 1 day of expiry. response.set_cookie(cookie_name, - max_age=60*60*24, # 1 day expiry + max_age=60 * 60 * 24, path="/" + os.path.dirname(file_url)) else: response = render_to_response('licenses/nolicense.html') return response + def show_license(request): if 'lic' not in request.GET or 'url' not in request.GET: raise Http404 @@ -182,9 +194,11 @@ def show_license(request): 'url': request.GET['url']}, context_instance=RequestContext(request)) + def redirect_to_root(request): return redirect('/') + def file_server(request, path): url = path result = test_path(path) @@ -226,7 +240,8 @@ def file_server(request, path): else: for digest in digests: if not license_accepted(request, digest): - response = redirect('/license?lic=' + digest + "&url=" + url) + response = redirect( + '/license?lic=' + digest + "&url=" + url) if not response: mimetypes.init() @@ -2,10 +2,14 @@ from django.core.management import execute_manager import imp try: - imp.find_module('settings') # Assumed to be in the same directory. + imp.find_module('settings') except ImportError: import sys - sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__) + sys.stderr.write( + "Error: Can't find the file 'settings.py' in the directory " + "containing %r. It appears you've customized things.\n" + "You'll have to run django-admin.py, passing it your " + "settings module.\n" % __file__) sys.exit(1) import settings diff --git a/settings.py b/settings.py index 740eb05..9140ab7 100644 --- a/settings.py +++ b/settings.py @@ -9,30 +9,23 @@ PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.split(PROJECT_ROOT)[-1] ADMINS = ( - ('dooferlad', 'dooferlad@nanosheep.org'), + ('linaro-infrastructure', 'infrastructure@linaro.org'), ) MANAGERS = ADMINS DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'licenses.sqlite3', # Or path to database file if using sqlite3. - 'USER': '', # Not used with sqlite3. - 'PASSWORD': '', # Not used with sqlite3. - 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': '', # Set to empty string for default. Not used with sqlite3. + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': 'licenses.db', + 'USER': '', + 'PASSWORD': '', + 'HOST': '', + 'PORT': '', } } -# Local time zone for this installation. Choices can be found here: -# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name -# although not all choices may be available on all operating systems. -# On Unix systems, a value of None will cause Django to use the same -# timezone as the operating system. -# If running in a Windows environment this must be set to the same as your -# system time zone. -TIME_ZONE = 'America/Chicago' +TIME_ZONE = None # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html @@ -40,16 +33,11 @@ LANGUAGE_CODE = 'en-us' SITE_ID = 1 -# If you set this to False, Django will make some optimizations so as not -# to load the internationalization machinery. USE_I18N = True - -# If you set this to False, Django will not format dates, numbers and -# calendars according to the current locale USE_L10N = True -# Absolute filesystem path to the directory that will hold user-uploaded files. -# Example: "/home/media/media.lawrence.com/media/" +# Absolute filesystem path to the directory that will hold user-uploaded +# files. Example: "/home/media/media.lawrence.com/media/" MEDIA_ROOT = '' # URL that handles the media served from MEDIA_ROOT. Make sure to use a diff --git a/testplans/__init__.py b/testplans/__init__.py index 4a85837..0ab05c1 100644 --- a/testplans/__init__.py +++ b/testplans/__init__.py @@ -2,6 +2,7 @@ import os import unittest import doctest + def test_suite(): suite = unittest.TestSuite() for filename in os.listdir("testplans/"): diff --git a/tests/__init__.py b/tests/__init__.py index e53b2f5..323eec4 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -4,6 +4,8 @@ import unittest def test_suite(): module_names = [ 'tests.test_click_through_license.TestLicense', + 'tests.test_pep8.TestPep8', + 'tests.test_pyflakes.TestPyflakes', 'tests.test_publish_to_snapshots.TestSnapshotsPublisher', ] loader = unittest.TestLoader() diff --git a/tests/license_protected_file_downloader.py b/tests/license_protected_file_downloader.py index dd7e890..b99ce02 100644 --- a/tests/license_protected_file_downloader.py +++ b/tests/license_protected_file_downloader.py @@ -4,7 +4,6 @@ import argparse import os import pycurl import re -import urllib import urlparse import html2text from BeautifulSoup import BeautifulSoup @@ -221,7 +220,8 @@ class LicenseProtectedFileFetcher: submit_url = action # The license is in a div with the ID license-text, so we - # use this to ?lic={{ license.digest }}&url={{ url }}" method="post">pull just the license out of the HTML. + # use this to ?lic={{ license.digest }}&url={{ url }}" + # method="post">pull just the license out of the HTML. html_license = u"" for chunk in soup.findAll(id="license-text"): # Output of chunk.prettify is UTF8, but comes back diff --git a/tests/test_click_through_license.py b/tests/test_click_through_license.py index 4a0520d..4b16c9f 100644 --- a/tests/test_click_through_license.py +++ b/tests/test_click_through_license.py @@ -327,4 +327,3 @@ class TestLicense(TestCase): testfile = fetcher.get(host + build_info_openid_test_file) fetcher.close() self.assertThat(testfile, Contains(search)) - diff --git a/tests/test_publish_to_snapshots.py b/tests/test_publish_to_snapshots.py index 5ce7aed..d7953c2 100644 --- a/tests/test_publish_to_snapshots.py +++ b/tests/test_publish_to_snapshots.py @@ -23,7 +23,7 @@ class TestSnapshotsPublisher(TestCase): self.parser.add_argument("-j", "--job-name", dest="job_name") self.parser.add_argument("-n", "--build-num", dest="build_num", type=int) - self.parser.add_argument("-m", "--manifest", dest="manifest", + self.parser.add_argument("-m", "--manifest", dest="manifest", action='store_true') if not os.path.isdir(self.uploads_path): os.mkdir(self.uploads_path) @@ -74,7 +74,7 @@ class TestSnapshotsPublisher(TestCase): stderr = sys.stderr = StringIO() self.publisher = SnapshotsPublisher() param = self.parser.parse_args( - ['-t', 'invalid_job_type', '-j', 'dummy_job_name', '-n', '1']) + ['-t', 'invalid_job_type', '-j', 'dummy_job_name', '-n', '1']) try: self.publisher.validate_args(param) except SystemExit, err: @@ -15,13 +15,19 @@ urlpatterns = patterns('', url(r'^logout/$', 'django.contrib.auth.views.logout'), # The license page... - url(r'^license$', 'license_protected_downloads.views.show_license', name='show_license'), + url(r'^license$', + 'license_protected_downloads.views.show_license', + name='show_license'), # Exceptions redirected to root... - url(r'^license', 'license_protected_downloads.views.redirect_to_root', name='redirect_to_root'), + url(r'^license', + 'license_protected_downloads.views.redirect_to_root', + name='redirect_to_root'), # Accept the license - url(r'^accept-license', 'license_protected_downloads.views.accept_license', name='accept_license'), + url(r'^accept-license', + 'license_protected_downloads.views.accept_license', + name='accept_license'), # Catch-all. We always return a file (or try to) if it exists. # This handler does that. |