Hi Alex,
Yes, there is authentication on the request, but that's working fine.
I tried taking out the auth and there was little difference.
Here's a chunk from urls.py
picture_resource = Collection(
queryset = Picture.objects.all(),
permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),
expose_fields = ('id', 'title', 'caption', 'single', 'story',
'position', 'is_live', 'keep', 'remove', 'fullsize_filename',
'created_at', 'updated_at'),
receiver = PictureReceiver(),
responder = XMLResponder(paginate_by = 2),
authentication = HttpBasicAuthentication()
)
Here's the receiver:
class PictureReceiver(Receiver):
def __init__(self):
print "PictureReceiver"
def get_data(self, request, method):
print request.REQUEST['title']
print request.REQUEST['caption']
print request.REQUEST['position']
print request.REQUEST['single']
print request.REQUEST['story']
print request.REQUEST['is_live']
def get_post_data(self, request):
print "POST Request"
return self.get_data(request, 'POST')
Just printing to the console for debug.
And here's the cURL POST command:
curl -F "title=title1" -F "caption=caption1" -F position=42 -F
"fullsize_filename=@test-post.jpg;image/jpeg" -F "single=on" -F
"story=1" -F "is_live=on" -F "created_at_0=2008-09-20" -F
"created_at_1=00:46:19" -F "updated_at_0=2008-09-20" -F
"updated_at_1=00:46:21" -F "_save=Save"
http://localhost:8000/xml/picture/
> error.html