On Fri, Jan 7, 2011 at 7:57 PM, Conor <[email protected]> wrote:

> Hello, I am new to Django and working on integrating it with
> MailChimp. I am implementing call back handlers for their Web Hooks.
> This should be just views.
>
> Anyway, I am testing running the dev server and seeing that the views
> are called just fine for GET requests, but for POST requests, all I
> see is this:
>
> [07/Jan/2011 18:12:01] "POST /newsletters/callback HTTP/1.1" 500 63243
>
> Even though I am printing output in the view code which should be
> logging. Any ideas why this should be resulting in such an error on
> the dev server? Because it is not printing anything out for POSTs it
> must be somehow circumventing the view code. Am I missing something.
>
> Here is my handler code:
>
> def handle_mailchimp_callback(request):
>    response =  http.HttpResponse()
>    response.status_code = 200
>    if request.POST:
>        print "POSTING"
>    else:
>        print "GETTTING"
>    return response
>
> Here is the server console output for a GET request:
>
> [07/Jan/2011 18:54:59] "GET /newsletters/callback HTTP/1.1" 301 0
> GETTTING
> [07/Jan/2011 18:54:59] "GET /newsletters/callback/ HTTP/1.1" 200 0
>

That GET output is showing that the callback URL without a slash at the end
is getting redirected to a version with the slash at the end.

For POST, with DEBUG=True, Django attempts to notify you (as far back as
release 1.0) of the potential problem of loss of post data during this
redirect via this code:

http://code.djangoproject.com/browser/django/tags/releases/1.0/django/middleware/common.py#L60

I don't know MailChimp, but you should either configure it to request
callback URLs that include trailing slashes, or configure your URLs for
these callbacks so that they do not require the trailing slash.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
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