Commit 108a0e6d authored by Marko Kuder's avatar Marko Kuder
Browse files

fix KeyError on posts to report_opsi_issue without message

occasionally happened because of automated bots on the site, which caused trash error email sending to admin
parent 43e553f1
......@@ -472,10 +472,10 @@ class PackageController(ckan.controllers.package.PackageController):
except HTTPError:
errors['captcha'] = [u'Napaka pri preverjanju captcha']
error_summary['captcha'] = u'Prišlo je do napake pri preverjanju ReCAPTCHA. Prosimo, poskusite ponovno.'
if data_dict["message"].strip() == '':
if data_dict.get('message', '').strip() == '':
errors['message'] = [u'Manjkajoča vrednost']
error_summary['message'] = u'Komentar je obvezen.'
elif data_dict.get('email', '') == '':
elif data_dict.get('email', '').strip() == '':
errors['email'] = [u'Manjkajoča vrednost']
error_summary['email'] = u'Email je obvezen.'
elif not re.compile(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)").match(data_dict.get('email', '')):
......@@ -530,12 +530,12 @@ class PackageController(ckan.controllers.package.PackageController):
except logic.NotAuthorized:
base.abort(401, _('Not authorized to see this page'))
if data_dict["message"].strip() == '' and (not 'publish' in request.params):
if data_dict.get('message', '').strip() == '') and (not 'publish' in request.params):
errors['message'] = [u'Če zbirka ne bo objavljena, je komentar obvezen.']
error_summary['message'] = u'Manjkajoča vrednost'
vars = {'data': data, 'errors': errors, 'error_summary': error_summary}
return p.toolkit.render('package/change_status.html', extra_vars=vars)
if data_dict["message"].strip() != '':
if data_dict.get('message', '').strip() != '':
er, er_sum = self._send_message_to_owner(pkg_dict, data_dict)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment