diff --git a/django/contrib/gis/measure.py b/django/contrib/gis/measure.py index 0343211495..b8070c715a 100644 --- a/django/contrib/gis/measure.py +++ b/django/contrib/gis/measure.py @@ -234,7 +234,7 @@ class Distance(MeasureBase): 'british_yd': 0.914398414616, 'clarke_ft': 0.3047972654, 'clarke_link': 0.201166195164, - 'fathom': 1.8288, + 'fathom': 1.8288, 'ft': 0.3048, 'german_m': 1.0000135965, 'gold_coast_ft': 0.304799710181508, diff --git a/django/contrib/gis/tests/geoapp/test_feeds.py b/django/contrib/gis/tests/geoapp/test_feeds.py index fac81614c9..9ae06d76e0 100644 --- a/django/contrib/gis/tests/geoapp/test_feeds.py +++ b/django/contrib/gis/tests/geoapp/test_feeds.py @@ -49,7 +49,7 @@ class GeoFeedTest(TestCase): # Incrementing through the feeds. for feed in [feed1, feed2]: # Ensuring the georss namespace was added to the element. - self.assertEqual(feed.getAttribute('xmlns:georss'), 'http://www.georss.org/georss') + self.assertEqual(feed.getAttribute('xmlns:georss'), 'http://www.georss.org/georss') chan = feed.getElementsByTagName('channel')[0] items = chan.getElementsByTagName('item') self.assertEqual(len(items), City.objects.count()) @@ -69,7 +69,7 @@ class GeoFeedTest(TestCase): for feed in [feed1, feed2]: # Ensuring the georsss namespace was added to the element. - self.assertEqual(feed.getAttribute('xmlns:georss'), 'http://www.georss.org/georss') + self.assertEqual(feed.getAttribute('xmlns:georss'), 'http://www.georss.org/georss') entries = feed.getElementsByTagName('entry') self.assertEqual(len(entries), City.objects.count()) diff --git a/django/contrib/gis/tests/relatedapp/tests.py b/django/contrib/gis/tests/relatedapp/tests.py index b165699e22..b478005c40 100644 --- a/django/contrib/gis/tests/relatedapp/tests.py +++ b/django/contrib/gis/tests/relatedapp/tests.py @@ -27,7 +27,7 @@ class RelatedGeoModelTest(TestCase): cities = ( ('Aurora', 'TX', -97.516111, 33.058333), ('Roswell', 'NM', -104.528056, 33.387222), - ('Kecksburg', 'PA', -79.460734, 40.18476), + ('Kecksburg', 'PA', -79.460734, 40.18476), ) for qs in (qs1, qs2, qs3): diff --git a/django/contrib/sitemaps/__init__.py b/django/contrib/sitemaps/__init__.py index 31d2d8c5d9..db31043bfa 100644 --- a/django/contrib/sitemaps/__init__.py +++ b/django/contrib/sitemaps/__init__.py @@ -6,9 +6,11 @@ from django.utils.six.moves.urllib.request import urlopen PING_URL = "http://www.google.com/webmasters/tools/ping" + class SitemapNotFound(Exception): pass + def ping_google(sitemap_url=None, ping_url=PING_URL): """ Alerts Google that the sitemap for the current site has been updated. @@ -35,6 +37,7 @@ def ping_google(sitemap_url=None, ping_url=PING_URL): params = urlencode({'sitemap': url}) urlopen("%s?%s" % (ping_url, params)) + class Sitemap(object): # This limit is defined by Google. See the index documentation at # http://sitemaps.org/protocol.php#index. @@ -94,22 +97,24 @@ class Sitemap(object): (latest_lastmod is None or lastmod > latest_lastmod)): latest_lastmod = lastmod url_info = { - 'item': item, - 'location': loc, - 'lastmod': lastmod, + 'item': item, + 'location': loc, + 'lastmod': lastmod, 'changefreq': self.__get('changefreq', item, None), - 'priority': str(priority if priority is not None else ''), + 'priority': str(priority if priority is not None else ''), } urls.append(url_info) if all_items_lastmod and latest_lastmod: self.latest_lastmod = latest_lastmod return urls + class FlatPageSitemap(Sitemap): def items(self): current_site = Site.objects.get_current() return current_site.flatpage_set.filter(registration_required=False) + class GenericSitemap(Sitemap): priority = None changefreq = None diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py index 9e191b1982..72c5d0854f 100644 --- a/django/core/management/commands/loaddata.py +++ b/django/core/management/commands/loaddata.py @@ -72,9 +72,9 @@ class Command(BaseCommand): self.serialization_formats = serializers.get_public_serializer_formats() self.compression_formats = { - None: open, - 'gz': gzip.GzipFile, - 'zip': SingleZipReader + None: open, + 'gz': gzip.GzipFile, + 'zip': SingleZipReader } if has_bz2: self.compression_formats['bz2'] = bz2.BZ2File diff --git a/django/core/management/validation.py b/django/core/management/validation.py index f0d6cae039..0a976d72a1 100644 --- a/django/core/management/validation.py +++ b/django/core/management/validation.py @@ -111,7 +111,7 @@ def get_validation_errors(outfile, app=None): try: max_digits = int(f.max_digits) if max_digits <= 0: - e.add(opts, mdigits_msg % f.name) + e.add(opts, mdigits_msg % f.name) else: mdigits_ok = True except (ValueError, TypeError): diff --git a/django/forms/extras/widgets.py b/django/forms/extras/widgets.py index 5590a9806a..95831679b8 100644 --- a/django/forms/extras/widgets.py +++ b/django/forms/extras/widgets.py @@ -19,6 +19,7 @@ __all__ = ('SelectDateWidget',) RE_DATE = re.compile(r'(\d{4})-(\d\d?)-(\d\d?)$') + def _parse_date_fmt(): fmt = get_format('DATE_FORMAT') escaped = False @@ -39,6 +40,7 @@ def _parse_date_fmt(): #if not self.first_select: self.first_select = 'day' return output + class SelectDateWidget(Widget): """ A Widget that splits date input into three