python - Django View is not getting processed completely after HttpResponse() call -
i have view named scan
takes modelform input and
sends view processscan
supposed getting value of input
scan
view , process in processscan
view.
currently, processscan
getting input scan
view , outputting value, isn't going past line:
return httpresponse("we got processor domain: " + entereddomain)
process
view looks like:
def scan(request): form = submitdomain(request.post or none) # form bound post data if request.method == 'post': # if form has been submitted... if form.is_valid(): # if form input passes initial validation... domainnmcleaned = form.cleaned_data['domainnm'] ## clean data in dictionary form.save() #save cleaned data db dictionary try: return httpresponseredirect('/processscan/?domainnm=' + domainnmcleaned) except: raise validationerror(('invalid request'), code='invalid') ## [ todo ]: add custom error page here. else: form = submitdomain() return render(request, 'va/index.html', { 'form' : form })
processscan
view looks like:
def processscan(request): # mechanize setup harvest = mechanize.browser() harvest.addheaders = settings.mechanize_user_agent_harvesting entereddomain = request.get.get('domainnm') return httpresponse("we got processor domain: " + entereddomain) mechanizebrowser = mechanize.browser mechanizebrowser.addheaders = [('user-agent', 'mozilla/5.0 (x11; u; linux i686; en-us; rv:1.9.0.1) gecko/2008071615 fedora/3.0.1-1.fc9 firefox/3.0.1')] r=mechanizebrowser.open('http://www.thedomain.com') output = r.read() print output
currently, output stopping right here, when should continuing in processscan
:
return httpresponse("we got processor domain: " + entereddomain)
any idea going wrong?
anything after return httpresponse
gets ignored line causes view return httpresponse
object. django uses construct server reply with.
just take line out.
Comments
Post a Comment