Skip to content

Commit

Permalink
pep8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankBie2 committed Jan 4, 2012
1 parent db0fdae commit 942cf4f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions cms/menu.py
Expand Up @@ -68,7 +68,7 @@ def get_visible_pages(request, pages, site=None):
# no restriction applied at all
if (not is_auth_user and
is_setting_public_all and
len(restricted_pages) == 0):
not restricted_pages):
return [page.pk for page in pages]


Expand All @@ -85,14 +85,14 @@ def get_visible_pages(request, pages, site=None):
#no page perms edgcase - all visible
if ((is_setting_public_all or (
is_setting_public_staff and request.user.is_staff))and
len(restricted_pages) == 0 and
global_view_perms == False):
not restricted_pages and
not global_view_perms):
return [page.pk for page in pages]
#no page perms edgcase - none visible
elif (is_setting_public_staff and
not request.user.is_staff and
len(restricted_pages) == 0 and
global_view_perms == False):
not restricted_pages and
not global_view_perms):
return []


Expand All @@ -112,14 +112,11 @@ def has_permission_membership(page):
for perm in restricted_pages[page_pk]:
if perm.user_id == user_pk:
has_perm = True

for perm in restricted_pages[page_pk]:
if not perm.group_id:
continue
group_user_ids = perm.group.user_set.values_list('pk', flat=True)
if user_pk in group_user_ids and len(group_user_ids) > 0 :
if user_pk in group_user_ids:
has_perm = True

return has_perm

for page in pages:
Expand Down

0 comments on commit 942cf4f

Please sign in to comment.