Permalink
Browse files

Don't throw exception when approving a blog with no name

  • Loading branch information...
1 parent 53505f9 commit acb32110947a73c8a369d8ad4200b144bf9c24ec @mhagander committed Sep 24, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 hamnadmin/register/admin.py
@@ -12,12 +12,16 @@ class Meta:
def clean_approved(self):
if self.cleaned_data['approved'] != self.instance.approved:
# Approved flag has changed, send an email
+ if self.cleaned_data.has_key('name'):
+ name = self.cleaned_data['name']
+ else:
+ name = "<empty>"
send_mail('A planet blog has been %s' % (
self.cleaned_data['approved'] and 'approved' or 'de-approved',
),
"The blog %s (for user %s, userid %s) has been %s." % (
self.cleaned_data['feedurl'],
- self.cleaned_data['name'],
+ name,
self.cleaned_data['userid'],
self.cleaned_data['approved'] and 'approved' or 'de-approved',
), 'webmaster@postgresql.org', [settings.NOTIFYADDR])

0 comments on commit acb3211

Please sign in to comment.