Skip to content

Commit

Permalink
Merge pull request #370 from jdufresne/unused-args
Browse files Browse the repository at this point in the history
Remove unused *args from get_objects() functions
  • Loading branch information
kimarakov committed Jan 3, 2018
2 parents 6ad2129 + b09cbc7 commit 866cdcc
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions schedule/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def get_additional_occurrences(self, start, end):
return [occ for _, occ in list(self.lookup.items()) if (occ.start < end and occ.end >= start and not occ.cancelled)]


def get_occurrence(request, *args, **kwargs):
def get_occurrence(request, **kwargs):
from schedule.models import Occurrence
occurrence = None
if 'occurrence_id' in kwargs:
Expand All @@ -109,7 +109,7 @@ def get_occurrence(request, *args, **kwargs):
return occurrence


def get_event(occurrence, request, *args, **kwargs):
def get_event(occurrence, request, **kwargs):
from schedule.models import Event
event = None
if occurrence:
Expand All @@ -127,7 +127,7 @@ def get_event(occurrence, request, *args, **kwargs):
return event


def get_calendar(event, request, *args, **kwargs):
def get_calendar(event, request, **kwargs):
from schedule.models import Calendar
calendar = None
if event:
Expand All @@ -145,10 +145,10 @@ def get_calendar(event, request, *args, **kwargs):
return calendar


def get_objects(request, *args, **kwargs):
occurrence = get_occurrence(request, *args, **kwargs)
event = get_event(occurrence, request, *args, **kwargs)
calendar = get_calendar(event, request, *args, **kwargs)
def get_objects(request, **kwargs):
occurrence = get_occurrence(request, **kwargs)
event = get_event(occurrence, request, **kwargs)
calendar = get_calendar(event, request, **kwargs)
return occurrence, event, calendar


Expand All @@ -158,7 +158,7 @@ def decorator(request, *args, **kwargs):
user = request.user
if not user:
return HttpResponseRedirect(settings.LOGIN_URL)
occurrence, event, calendar = get_objects(request, *args, **kwargs)
occurrence, event, calendar = get_objects(request, **kwargs)
if calendar and event:
allowed = (CHECK_EVENT_PERM_FUNC(event, user) and
CHECK_CALENDAR_PERM_FUNC(calendar, user) and
Expand All @@ -177,7 +177,7 @@ def decorator(request, *args, **kwargs):
user = request.user
if not user:
return HttpResponseRedirect(settings.LOGIN_URL)
occurrence, event, calendar = get_objects(request, *args, **kwargs)
occurrence, event, calendar = get_objects(request, **kwargs)
if calendar:
allowed = (CHECK_EVENT_PERM_FUNC(event, user) and
CHECK_CALENDAR_PERM_FUNC(calendar, user))
Expand All @@ -196,7 +196,7 @@ def decorator(request, *args, **kwargs):
user = request.user
if not user:
return HttpResponseRedirect(settings.LOGIN_URL)
occurrence, event, calendar = get_objects(request, *args, **kwargs)
occurrence, event, calendar = get_objects(request, **kwargs)
if calendar:
allowed = CHECK_CALENDAR_PERM_FUNC(calendar, user)
if not allowed:
Expand Down

0 comments on commit 866cdcc

Please sign in to comment.