def post(request):
    if request.user.is_anonymous():
        return redirect('/login/')
    
    form = BlastForm(request.POST, request.FILES)
    if form.is_valid():
        blast = form.save(commit = False)
        if blast.message.startswith('?'):
            return redirect('/search/?' + urllib.urlencode({
                'q': blast.message[1:].strip(),
            }))
        else:
            blast.message = blast.message.strip()
        blast.user = request.user
        blast.save()
    
    return redirect('/')
dataset/ETHPy150Open simonw/bugle_project/bugle_project/bugle/views.py/post/original