[1.8.x] Fixed flake8 2.6 warnings.

Backport of ea34426ae7 from master
This commit is contained in:
Tim Graham 2016-06-16 09:07:51 -04:00
parent ba29dfb191
commit 4da3684f24
3 changed files with 8 additions and 24 deletions

View File

@ -45,14 +45,14 @@ class SpatialRefSysMixin(object):
try:
self._srs = gdal.SpatialReference(self.wkt)
return self.srs
except Exception as msg:
pass
except Exception as e:
msg = e
try:
self._srs = gdal.SpatialReference(self.proj4text)
return self.srs
except Exception as msg:
pass
except Exception as e:
msg = e
raise Exception('Could not get OSR SpatialReference from WKT: %s\nError:\n%s' % (self.wkt, msg))
else:

View File

@ -1,10 +0,0 @@
from django.db.models.sql import aggregates
from django.db.models.sql.aggregates import * # NOQA
__all__ = ['Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union'] + aggregates.__all__
warnings.warn(
"django.contrib.gis.db.models.sql.aggregates is deprecated. Use "
"django.contrib.gis.db.models.aggregates instead.",
RemovedInDjango110Warning, stacklevel=2)

View File

@ -99,12 +99,9 @@ class LiveServerViews(LiveServerBase):
Ensure that the LiveServerTestCase serves 404s.
Refs #2879.
"""
try:
with self.assertRaises(HTTPError) as err:
self.urlopen('/')
except HTTPError as err:
self.assertEqual(err.code, 404, 'Expected 404 response')
else:
self.fail('Expected 404 response')
self.assertEqual(err.exception.code, 404, 'Expected 404 response')
def test_view(self):
"""
@ -128,12 +125,9 @@ class LiveServerViews(LiveServerBase):
tries to access a static file that isn't explicitly put under
STATIC_ROOT.
"""
try:
with self.assertRaises(HTTPError) as err:
self.urlopen('/static/another_app/another_app_static_file.txt')
except HTTPError as err:
self.assertEqual(err.code, 404, 'Expected 404 response')
else:
self.fail('Expected 404 response (got %d)' % err.code)
self.assertEqual(err.exception.code, 404, 'Expected 404 response')
def test_media_files(self):
"""