Skip to content

Commit 199b4ec

Browse files
committed
Fix a few flake8 warnings
1 parent c2ba86e commit 199b4ec

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

feincms/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ def ensure_completely_loaded(force=False):
8080
# http://goo.gl/XNI2qz
8181
model._meta._fill_fields_cache()
8282

83-
# Calls to get_models(...) are cached by the arguments used in the call.
84-
# This cache is normally cleared in loading.register_models(), but we
85-
# invalidate the get_models() cache, by calling get_models
86-
# above before all apps have loaded. (Django's load_app() doesn't clear the
83+
# Calls to get_models(...) are cached by the arguments used in the
84+
# call. This cache is normally cleared in loading.register_models(),
85+
# but we invalidate the get_models() cache, by calling get_models above
86+
# before all apps have loaded. (Django's load_app() doesn't clear the
8787
# get_models cache as it perhaps should). So instead we clear the
88-
# get_models cache again here. If we don't do this, Django 1.5 chokes on
89-
# a model validation error (Django 1.4 doesn't exhibit this problem).
90-
# See Issue #323 on github.
88+
# get_models cache again here. If we don't do this, Django 1.5 chokes
89+
# on a model validation error (Django 1.4 doesn't exhibit this
90+
# problem). See Issue #323 on github.
9191
if hasattr(apps, 'cache'):
9292
try:
9393
apps.cache.get_models.cache_clear() # Django 1.7+

feincms/module/page/processors.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
from django.conf import settings as django_settings
88
from django.http import Http404, HttpResponseRedirect
99

10+
1011
logger = logging.getLogger(__name__)
1112

13+
1214
def redirect_request_processor(page, request):
1315
"""
1416
Returns a ``HttpResponseRedirect`` instance if the current page says
@@ -19,7 +21,8 @@ def redirect_request_processor(page, request):
1921
extra_path = request._feincms_extra_context.get('extra_path', '/')
2022
if extra_path == '/':
2123
return HttpResponseRedirect(target)
22-
logger.debug("Page redirect on '%s' not taken because extra path '%s' present",
24+
logger.debug(
25+
"Page redirect on '%s' not taken because extra path '%s' present",
2326
page.get_absolute_url(), extra_path)
2427
raise Http404()
2528

feincms/views/cbv/views.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
from feincms._internal import get_model
1010
from feincms.module.mixins import ContentView
1111

12+
1213
logger = logging.getLogger(__name__)
1314

15+
1416
class Handler(ContentView):
1517
page_model_path = None
1618
context_object_name = 'feincms_page'
@@ -32,21 +34,27 @@ def dispatch(self, request, *args, **kwargs):
3234
return super(Handler, self).dispatch(request, *args, **kwargs)
3335
except Http404 as e:
3436
if settings.FEINCMS_CMS_404_PAGE is not None:
35-
logger.info("Http404 raised for '%s', attempting redirect to FEINCMS_CMS_404_PAGE", args[0])
37+
logger.info(
38+
"Http404 raised for '%s', attempting redirect to"
39+
" FEINCMS_CMS_404_PAGE", args[0])
3640
try:
37-
# Fudge environment so that we end up resolving the right page.
38-
# Note: request.path is used by the page redirect processor to
39-
# determine if the redirect can be taken, must be == to page url
41+
# Fudge environment so that we end up resolving the right
42+
# page.
43+
# Note: request.path is used by the page redirect processor
44+
# to determine if the redirect can be taken, must be == to
45+
# page url
4046
request.path = settings.FEINCMS_CMS_404_PAGE
4147
response = super(Handler, self).dispatch(
4248
request, settings.FEINCMS_CMS_404_PAGE, **kwargs)
43-
# Only set status if we actually have a page. If we get
44-
# for example a redirect, overwriting would yield a blank page
49+
# Only set status if we actually have a page. If we get for
50+
# example a redirect, overwriting would yield a blank page
4551
if response.status_code == 200:
4652
response.status_code = 404
4753
return response
4854
except Http404:
49-
logger.error("Http404 raised while resolving FEINCMS_CMS_404_PAGE=%s",
55+
logger.error(
56+
"Http404 raised while resolving"
57+
" FEINCMS_CMS_404_PAGE=%s",
5058
settings.FEINCMS_CMS_404_PAGE)
5159
raise e
5260
else:

0 commit comments

Comments
 (0)