Thanks!  The trailing slash was indeed my problem.

For those that come upon this later, if you're sending json data, use
django.utils.simplejson.loads(request.raw_post_data) to convert the
data into a python dict.

On Jan 21, 7:25 pm, Malcolm Tredinnick <[email protected]>
wrote:
> On Wed, 2009-01-21 at 16:47 -0800, junker37 wrote:
> > Thanks, I see the request.raw_post_datanow in my middleware class,
> > however, that request never gets to my view, but instead is sent back
> > as a 301 redirect and then the request_post_data is gone.
>
> A 301 redirect is effected as a GET request. So that's not unexpected
> behaviour.
>
>
>
> >   I'm
> > guessing one of the other middleware classes is causing that, but I
> > couldn't figure out which one from looking at the code.
>
> > Here are my middleware classes:
> > MIDDLEWARE_CLASSES = (
> >     'django.middleware.common.CommonMiddleware',
> >     'django.contrib.sessions.middleware.SessionMiddleware',
> >     'django.contrib.auth.middleware.AuthenticationMiddleware',
> >     'django_openid.consumer.SessionConsumer',
> >     'account.middleware.LocaleMiddleware',
> >     'django.middleware.doc.XViewMiddleware',
> >     'djangologging.middleware.LoggingMiddleware',
> >     'pagination.middleware.PaginationMiddleware',
> >     'misc.middleware.SortOrderMiddleware',
> >     'djangodblog.middleware.DBLogMiddleware',
> >     'django.middleware.transaction.TransactionMiddleware',
> > )
>
> Then try to work out a simpler case. Start removing middleware,
> particularly those that don't come in the default MIDDLEWARE_CLASSES
> list, until you isolate the problem. Debugging is done by changing
> things, one at at a time, and seeing which change affects the result.
>
> Check for the usual causes of redirection, such as not being logged in
> when authentication is required, not having a trailing slash on URLs
> when the common middleware would normally add on. Things like that.
>
> Also, if you're using the development server (or even if you're not),
> look at where the redirection is going to. It's very unlikely that
> you're being redirected back to exactly the same URL. That should give
> you some clue. Check for things like "/foo" being redirected to
> "/foo/" (which would indicate the common middleware is redirecting to
> the canonical URL form).
>
> > Do I need some sort of decorator for my view to allow PUT requests?
>
> No. Django, in general, doesn't care about the method. It will put the
> method name in request.method and give you the data via
> request.raw_post_data.
>
> Regards,
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
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