summaryrefslogtreecommitdiff
path: root/backend/views.py
diff options
context:
space:
mode:
authorMaksim A. Boyko <maksim.a.boyko@gmail.com>2012-08-25 15:44:29 -0400
committerMaksim A. Boyko <maksim.a.boyko@gmail.com>2012-08-25 15:44:29 -0400
commit3c723eda61de6846169d603eeb3cfbab82e4ceca (patch)
tree6b6b2774ca9332bc1d25543b9c4526766c8978d6 /backend/views.py
parent5cd27ce9393debcc73f97510dfdc567fd024eb33 (diff)
Backend: Refactoring
Diffstat (limited to 'backend/views.py')
-rw-r--r--backend/views.py13
1 files 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)