Code

#19163 closed Bug (needsinfo)

#bug about comment in views

Reported by: googcheng@… Owned by: nobody
Component: Generic views Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

the error case :

def uploadfile(request):
    #print request
    if request.method == 'POST':
        json_data = simplejson.loads(request.raw_post_data)
        data = json_data['data']
        print "aaaa"
    
        

    '''if request.method == 'POST':
        if request.FILES == None:
            return HttpResponseBadRequest('Must have files attached!')
        print "post",request.POST
        try:
	     f = request.FILES.get('file')
             print "request.FILES\n",request.FILES
	except:
	    print "error"
	
        
        
        url,id = handler(request.FILES['file'],request.POST.get('description',''),request.POST.get('tag',[]))  
        # Extend server-side upload handler to return a JSON response
        data = [{'name': f.name, 'url': url, 'delete_url': reverse('idel',args=[id]), 'delete_type': "DELETE"}]
        print data
        response = JSONResponse(data, {}, response_mimetype(request))
        response['Content-Disposition'] = 'inline; filename=files.json'
        return response '''  
    else:
        form = UploadFileForm()
    return render_to_response('index.html', {'form': form},
			    context_instance=RequestContext(request))

the right one:

def uploadfile(request):
    #print request
    if request.method == 'POST':
        json_data = simplejson.loads(request.raw_post_data)
        data = json_data['data']
        print "aaaa"
    else:
        form = UploadFileForm()
    return render_to_response('index.html', {'form': form},
			    context_instance=RequestContext(request))    
        

    '''if request.method == 'POST':
        if request.FILES == None:
            return HttpResponseBadRequest('Must have files attached!')
        print "post",request.POST
        try:
	     f = request.FILES.get('file')
             print "request.FILES\n",request.FILES
	except:
	    print "error"
	
        
        
        url,id = handler(request.FILES['file'],request.POST.get('description',''),request.POST.get('tag',[]))  
        # Extend server-side upload handler to return a JSON response
        data = [{'name': f.name, 'url': url, 'delete_url': reverse('idel',args=[id]), 'delete_type': "DELETE"}]
        print data
        response = JSONResponse(data, {}, response_mimetype(request))
        response['Content-Disposition'] = 'inline; filename=files.json'
        return response '''  
    

django requires coments length ?

Attachments (0)

Change History (1)

comment:1 Changed 21 months ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to needsinfo
  • Status changed from new to closed

Sorry, but this bug report lacks enough information. Please try to explain what you think is a bug as clearly as possible.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.