def validate_form(form):
messages = []
- if not 'pers_time' in form or form['pers_time'].value == 'none':
- messages.append("Please indicate how much time you spend in your personal computing environment.")
- if not 'man_time' in form or form['man_time'].value == 'none':
- messages.append("Please indicate how much time you spend in a managed computing environment.")
- if not 'virt_time' in form or form['virt_time'].value == 'none':
- messages.append("Please indicate how often you use virtual machines.")
if not 'bg_datamod' in form or not len(form.getlist('bg_datamod')):
messages.append("Please indicate want kind of data you are working with.")
if 'bg_datamod' in form and 'other' in form.getlist('bg_datamod') and not form['bg_datamod_other'].value:
messages.append("You selected 'Other data modality' but did not specific which one.")
+ if not 'pers_time' in form or form['pers_time'].value == 'none':
+ messages.append("Please indicate how much time you spend in your personal computing environment.")
if 'pers_maint_time' in form and form['pers_maint_time'].value:
try:
t = float(form['pers_maint_time'].value)
except:
messages.append("The value you entered as maintenance effort per month needs to be a (floating point) number. For example: 1.2 or 5")
+ if not 'man_time' in form or form['man_time'].value == 'none':
+ messages.append("Please indicate how much time you spend in a managed computing environment.")
+ if not 'virt_time' in form or form['virt_time'].value == 'none':
+ messages.append("Please indicate how often you use virtual machines.")
return messages
# IP
if 'REMOTE_ADDR' in os.environ:
result['remote_addr'] = os.environ['REMOTE_ADDR']
+ if 'HTTP_USER_AGENT' in os.environ:
+ result['user_agent'] = os.environ['HTTP_USER_AGENT']
return result
result['success'] = True
result = extract_results(form, result)
try:
- logfile = open('/home/neurodebian/surveydata/%s.json' % result['timestamp'], 'w+')
+ logfile = open('/home/neurodebian/survey/data/%s.json' % result['timestamp'], 'w+')
logfile.write(json.write(result))
logfile.write('\n')
logfile.close()
result['message'] = 'We are very sorry, but the server is unable to store your submission. Please contact team@neuro.debian.net.'
# send HTML snippet to let the submitter see the results
try:
- result['results'] = open('/home/www/neuro.debian.net/www/survey/results_snippet.html').read()
+ result['results'] = open('/home/neurodebian/survey/results_snippet.html').read()
except:
result['results'] = 'We are very sorry, but the statistics could not be displayed. Please contact team@neuro.debian.net to get access.'
else: