From 3fa267a0673418b06fe975faae2f5afeb6212620 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 31 Jan 2010 15:44:17 +0530 Subject: [PATCH] eror --- oxdb/backend/views.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/oxdb/backend/views.py b/oxdb/backend/views.py index c86030d..6530cf4 100644 --- a/oxdb/backend/views.py +++ b/oxdb/backend/views.py @@ -33,7 +33,7 @@ def api(request): if request.META['REQUEST_METHOD'] == "OPTIONS": response = HttpResponse('') #response = render_to_json_response({'status': {'code': 200, 'text': 'please use POST'}}) - #response['Access-Control-Allow-Origin'] = '*' + response['Access-Control-Allow-Origin'] = '*' return response if not 'action' in request.POST: return apidoc(request) @@ -67,7 +67,7 @@ def api_error(request): ''' trows 503 error ''' - this = is_an_error + success = error_is_success return render_to_json_response({}) def _order_query(qs, s, prefix='sort__'): @@ -454,6 +454,10 @@ def api_update(request): response = {'status': {'code': 403, 'text': 'permission denied'}} return render_to_json_response(response) +class UploadForm(forms.Form): + data = forms.TextInput() + file = forms.FileField() + def api_upload(request): #video, timeline, frame ''' upload video, timeline or frame @@ -462,10 +466,12 @@ def api_upload(request): #video, timeline, frame return {'status': {'code': int, 'text': string}, 'data': {}} ''' - data = json.loads(request.POST['data']) - if data['item'] == 'timeline': - pass - #print "not implemented" + form = LoginForm(request.POST, request.FILES) + if form.is_valid(): + data = json.loads(request.POST['data']) + if data['item'] == 'timeline': + pass + #print "not implemented" response = {'status': {'code': 501, 'text': 'not implemented'}} return render_to_json_response(response)