Hi there.
Could someone explain what happens. I had a little project on Python 2.7
and decided to move it on 3.6. Everything has gone by perfectly. The
project works well as before but there is one exception noticed by me: the
global statement works not always. The code below doesn't update the global
variable zip_file_name and I can't grasp why. On Python 2.7 everything
worked properly. Any suggestions
zip_file_name = ''
file_list = []
@permission_required("wb_search.change_wbsearch", login_url='access_denied')
@csrf_exempt
def input_data_form(request):
global zip_file_name, file_list
if request.method == 'POST':
form = WbSearchForm(request.POST)
if form.is_valid():
text = request.POST['wbs_nums']
picked = form.cleaned_data.get('category')
try:
wb_nums = process_input(text, LENGTH_OF_STR_TO_PROCESS)
zip_file_name, file_list = get_wb_pdf_as_zip(wb_nums, picked)
m = SearchHistory(user=str(request.user),
curr_date=datetime.now(), list_desired_docs=', '.join([str(rec[0]) for rec in
file_list]))
m.save()
return HttpResponseRedirect('/wb_search/search_finished/')
except NoDataToSearch:
return
HttpResponseRedirect('/wb_search/wb_search_incorrect_data/')
else:
return HttpResponseRedirect('/wb_search/wb_search_incorrect_data/')
else:
form = WbSearchForm()
# context = context.update(csrf(request))
return render_to_response('wb_search_input_data_form.html',
{'form': form, 'title': 'Номера для поиска',
'header': 'Поиск PDF файлов вэйбилов',
'text': 'Вставте в это поле номера вэйбилов PDF
файлы которых необходимо найти.',
'textarea_title': 'Вставте в это поле номера
вэйбилов PDF файлы которых необходимо '
'найти.',
'submit_title': 'Начать поиск',
'element_id': 'find_button', 'element_method':
'click',
'spinner_message': 'Ожидайте окончания
поиска...', },
RequestContext(request))
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/4e394c2e-140a-493b-b459-76f557d3cee4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.