From 3f411245e345dcc8a8be7613d430a41cbd8524cc Mon Sep 17 00:00:00 2001 From: David Cramer Date: Thu, 24 Mar 2016 23:55:58 -0700 Subject: [PATCH] Handle unset host/key --- sentry_redmine/forms.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sentry_redmine/forms.py b/sentry_redmine/forms.py index 5ea447a..3840d36 100644 --- a/sentry_redmine/forms.py +++ b/sentry_redmine/forms.py @@ -69,11 +69,12 @@ class RedmineOptionsForm(forms.Form): def clean(self): cd = self.cleaned_data - client = RedmineClient(cd['host'], cd['key']) - try: - client.get_projects() - except Exception: - raise forms.ValidationError('There was an issue authenticating with Redmine') + if cd.get('host') and cd.get('key'): + client = RedmineClient(cd['host'], cd['key']) + try: + client.get_projects() + except Exception: + raise forms.ValidationError('There was an issue authenticating with Redmine') return cd def clean_host(self):