[1.10.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 efe9874371
commit 70b7d6b4ea
4 changed files with 14 additions and 16 deletions

View File

@ -40,14 +40,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

@ -213,7 +213,7 @@ class Command(BaseCommand):
model_keys.append(model_key)
post_migrate_apps.unregister_model(*model_key)
post_migrate_apps.render_multiple([
ModelState.from_model(apps.get_model(*model_key)) for model_key in model_keys
ModelState.from_model(apps.get_model(*model)) for model in model_keys
])
# Send the post_migrate signal, so individual apps can do whatever they need

View File

@ -3,7 +3,11 @@ from __future__ import unicode_literals
from django.db import migrations, models
from ..fields import * # NOQA
from ..fields import (
ArrayField, BigIntegerRangeField, DateRangeField, DateTimeRangeField,
FloatRangeField, HStoreField, IntegerRangeField, JSONField,
SearchVectorField,
)
from ..models import TagField

View File

@ -104,12 +104,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):
"""
@ -133,12 +130,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):
"""