def create(self, request, trip_id):
        data = request.data
        current_user = rest.utils.get_rest_user(request)
        try:
            trip = server.models.Trip.objects.get(id=trip_id)
            status = data['status']
            person_participation = trip.get_participations().filter(author__username=current_user.username)
            if len(person_participation) > 0:
                return piston.utils.rc.DUPLICATE_ENTRY
            if status == server.models.Participation._status['request'][0]:
                result = server.passenger.requestRide(trip, current_user)
                result.value.href = rest.utils.get_href(request, 'participation_handler', [trip.id, result.value.author.username])
                result.value.save()
            else:
                result = server.models.Response(
                        server.models.Response.BAD_REQUEST,
                        'Message',
                         {'status': [u'This field is required and its value must be request.']})
            #TODO: stupid hack but works
            if 300 < result.code:
                result.value.status = result.value.get_status_name()
                return result.value
            return rest.utils.extract_result_from_response(result)

        except server.models.Trip.DoesNotExist:
            return piston.utils.rc.NOT_FOUND
        except KeyError, e:
            result = server.models.Response(
                    server.models.Response.BAD_REQUEST,
                    'Message',
                     e)

            return rest.utils.extract_result_from_response(result)
dataset/ETHPy150Open dgraziotin/dycapo/rest/wrappers/participation.py/ParticipationHandler.create/swapped operands of `<`