From 3c723eda61de6846169d603eeb3cfbab82e4ceca Mon Sep 17 00:00:00 2001 From: "Maksim A. Boyko" Date: Sat, 25 Aug 2012 15:44:29 -0400 Subject: Backend: Refactoring --- backend/views.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/backend/views.py b/backend/views.py index 244a782..fb07bb1 100644 --- a/backend/views.py +++ b/backend/views.py @@ -823,13 +823,12 @@ def api_room_video(request): def api_video_date(request): """ View top videos by date. Public API """ - form_fields = ['day', 'month', 'year'] - response = check_form_fields(request, form_fields) - if response: - return response - p = request.POST - if is_number(p['year']) and is_number(p['month']) and is_number(p['day']): - today = datetime(int(p['year']), int(p['month']), int(p['day'])) + year = request.POST.get('year', '') + month = request.POST.get('month', '') + day = request.POST.get('day', '') + + if is_number(year) and is_number(month) and is_number(day): + today = datetime(int(year), int(month), int(day)) else: today = datetime.fromtimestamp(time.mktime(date.today().timetuple())) tomorrow = today + timedelta(days=1) -- cgit v1.2.3-70-g09d2