Changeset 74b9c4d in OpenWorkouts-current for ow


Ignore:
Timestamp:
Dec 18, 2018, 10:24:34 AM (5 years ago)
Author:
borja <borja@…>
Branches:
current, feature/docs, master
Children:
d507f75
Parents:
4554843
Message:

Fixed FormEncode? bug with empty file uploads in the views that handle posting

tracking files for new/existing workouts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ow/views/workout.py

    r4554843 r74b9c4d  
    6464    Add a workout uploading a tracking file
    6565    """
     66    # if not given a file there is an empty byte in POST, which breaks
     67    # our blob storage validator.
     68    # dirty fix until formencode fixes its api.is_empty method
     69    if isinstance(request.POST.get('tracking_file', None), bytes):
     70        request.POST['tracking_file'] = ''
     71
    6672    form = Form(request, schema=UploadedWorkoutSchema())
    6773
     
    129135    renderer='ow:templates/update_workout_from_file.pt')
    130136def update_workout_from_file(context, request):
     137    # if not given a file there is an empty byte in POST, which breaks
     138    # our blob storage validator.
     139    # dirty fix until formencode fixes its api.is_empty method
     140    if isinstance(request.POST.get('tracking_file', None), bytes):
     141        request.POST['tracking_file'] = ''
     142
    131143    form = Form(request, schema=UpdateWorkoutSchema())
    132144    if 'submit' in request.POST and form.validate():
Note: See TracChangeset for help on using the changeset viewer.