@handle_response_format
@treeio_login_required
def location_delete(request, location_id, response_format='html'):
    "Location delete page"
    location = get_object_or_404(Location, pk=location_id)
    if not request.user.profile.has_permission(location, mode="w"):
        return user_denied(request, message="You don't have write access to this Location")

    if request.POST:
        if request.POST in 'delete':
            if 'trash' in request.POST:
                location.trash = True
                location.save()
            else:
                location.delete()
            return HttpResponseRedirect(reverse('identities_index'))
        elif 'cancel' in request.POST:
            return HttpResponseRedirect(reverse('identities_location_view', args=[location.id]))

    context = _get_default_context(request)
    context.update({'location': location})

    return render_to_response('identities/location_delete', context,
                              context_instance=RequestContext(request), response_format=response_format)


#
# Settings
#
dataset/ETHPy150Open treeio/treeio/treeio/identities/views.py/location_delete/swapped operands of `in`