Skip to content

Commit

Permalink
Merge pull request #3827 from timgraham/flake8
Browse files Browse the repository at this point in the history
Fixed some flake8 warnings
  • Loading branch information
yakky committed Feb 7, 2015
2 parents a19923b + 5ada7d1 commit c94780f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 24 deletions.
8 changes: 4 additions & 4 deletions cms/templatetags/cms_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class ShowAdminMenu(InclusionTag):
def get_context(self, context, page):
request = context['request']

if context.has_key("cl"):
if 'cl' in context:
filtered = context['cl'].is_filtered()
elif context.has_key('filtered'):
elif 'filtered' in context:
filtered = context['filtered']
language = context['preview_language']

Expand Down Expand Up @@ -105,9 +105,9 @@ class ShowLazyAdminMenu(InclusionTag):
def get_context(self, context, page):
request = context['request']

if context.has_key("cl"):
if 'cl' in context:
filtered = context['cl'].is_filtered()
elif context.has_key('filtered'):
elif 'filtered' in context:
filtered = context['filtered']

language = context['preview_language']
Expand Down
2 changes: 1 addition & 1 deletion cms/test_utils/project/emailuserapp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AbstractEmailUser(AbstractBaseUser, PermissionsMixin):
"""

email = models.EmailField(
'email address',
'email address',
blank=True,
unique=True,
help_text = "Required. Standard format email address."
Expand Down
6 changes: 3 additions & 3 deletions cms/tests/apphooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def test_get_sub_page_for_apphook_with_implicit_current_app(self):

@override_settings(ROOT_URLCONF='cms.test_utils.project.second_urls_for_apphook_tests')
def test_default_language_changer_with_implicit_current_app(self):
titles = self.create_base_structure(NS_APP_NAME, ['en', 'de'], 'namespaced_app_ns') # nopyflakes
self.create_base_structure(NS_APP_NAME, ['en', 'de'], 'namespaced_app_ns')
self.reload_urls()
with force_language("en"):
path = reverse('namespaced_app_ns:translated-url')
Expand Down Expand Up @@ -491,7 +491,7 @@ class TestApp2(CMSApp):

@override_settings(ROOT_URLCONF='cms.test_utils.project.second_urls_for_apphook_tests')
def test_toolbar_current_app_namespace(self):
en_title = self.create_base_structure(NS_APP_NAME, 'en', 'instance_ns') # nopyflakes
self.create_base_structure(NS_APP_NAME, 'en', 'instance_ns')
with force_language("en"):
path = reverse('namespaced_app_ns:sample-settings')
request = self.get_request(path)
Expand All @@ -513,7 +513,7 @@ def test_toolbar_current_app_namespace(self):

@override_settings(ROOT_URLCONF='cms.test_utils.project.second_urls_for_apphook_tests')
def test_toolbar_current_app_apphook_with_implicit_current_app(self):
en_title = self.create_base_structure(NS_APP_NAME, 'en', 'namespaced_app_ns') # nopyflakes
self.create_base_structure(NS_APP_NAME, 'en', 'namespaced_app_ns')
with force_language("en"):
path = reverse('namespaced_app_ns:current-app')
request = self.get_request(path)
Expand Down
2 changes: 1 addition & 1 deletion cms/tests/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def test_language_code(self):
'name': 'French',
'public': True},
]
},
},
)
def test_session_language(self):
page = api.create_page("home", "nav_playground.html", "en", published=True)
Expand Down
22 changes: 10 additions & 12 deletions cms/utils/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ def has_any_page_change_permissions(request):
if not request.user.is_authenticated():
return False
return request.user.is_superuser or PagePermission.objects.filter(
page__site=current_site(request)
).filter((
Q(user=request.user) |
Q(group__in=request.user.groups.all())
)).exists()
page__site=current_site(request)
).filter(
Q(user=request.user) |
Q(group__in=request.user.groups.all())
).exists()


def has_page_change_permission(request):
Expand Down Expand Up @@ -242,17 +242,15 @@ def get_subordinate_groups(user):
except NoPermissionsException:
# no permission no records
# page_id_allow_list is empty
qs = Group.objects.distinct().filter(
Q(pageusergroup__created_by=user) &
Q(pagepermission__page=None)
return Group.objects.distinct().filter(
Q(pageusergroup__created_by=user) &
Q(pagepermission__page=None)
)
return qs

qs = Group.objects.distinct().filter(
(Q(pagepermission__page__id__in=page_id_allow_list) & Q(pagepermission__page__level__gte=user_level))
return Group.objects.distinct().filter(
(Q(pagepermission__page__id__in=page_id_allow_list) & Q(pagepermission__page__level__gte=user_level))
| (Q(pageusergroup__created_by=user) & Q(pagepermission__page=None))
)
return qs


def has_global_change_permissions_permission(request):
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'djangocms.tex', u'django cms Documentation',
u'Patrick Lauber', 'manual'),
('index', 'djangocms.tex', u'django cms Documentation',
u'Patrick Lauber', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ universal=1

[flake8]
exclude=south_migrations
ignore=E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E201,E202,E203,E221,E225,E226,E231,E241,E251,E261,E262,E265,E271,E301,E302,E303,E501,E502,E701,E713,E714,F401,F403,F841,W601
ignore=E122,E123,E124,E125,E126,E127,E128,E129,E131,E201,E202,E203,E221,E225,E226,E231,E241,E251,E261,E262,E265,E271,E301,E302,E303,E501,E502,E701,E713,E714,F401,F403

0 comments on commit c94780f

Please sign in to comment.