It looks like it's because (as you said), I'm returning a string, in
the exception... so how do I do that?

def add_song(request):
     try:
        f = open('/path/to/songs/'+
request.FILES['song_file']['filename'], 'wb') # wb = write binary
        f.write(request.FILES['song_file']['content'])
        f.close()
     except:
        return HttpResponse("Are you sure you selected a song to
upload?", mimetype="text/html")
     song = Song(artist_id=request.user.id, song_file=
"songs/"+request.FILES['song_file']['filename'],song_title=
request.POST['song_title'],pub_date=datetime.now(),
description=request.POST['description'])
     song.save()


On Jan 24, 3:29 pm, Michael Radziej <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED]:
>
> > What would cause an (intermittent) error saying my view didn't return
> > an HttpResponse object?Perhaps, a missing return in your view function. Or 
> > if you try to
> return directly a string. It gets intermittent if it's only
> missing/wrong in a seldom used branch.
>
> Michael
> --
> noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
> Tel +49-911-9352-0 - Fax +49-911-9352-100
> 
> http://www.noris.de- The IT-Outsourcing Company


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to