Skip to content
Browse files

Fix form `clean` method

In cases when current user haven't right to publish current page
`published` key isn't available in `cleaned_data` dictionary
  • Loading branch information...
1 parent 9f322fa commit b8f9fab04e1576a5dab5ab5b66a1a0045275da3e @neoascetic neoascetic committed Oct 1, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 cms/admin/forms.py
View
2 cms/admin/forms.py
@@ -116,7 +116,7 @@ def clean(self):
if site and not is_valid_page_slug(page, parent, lang, slug, site):
self._errors['slug'] = ErrorList([_('Another page with this slug already exists')])
del cleaned_data['slug']
- if self.cleaned_data['published'] and page.title_set.count():
+ if self.cleaned_data.get('published') and page.title_set.count():
#Check for titles attached to the page makes sense only because
#AdminFormsTests.test_clean_overwrite_url validates the form with when no page instance available
#Looks like just a theoretical corner case

0 comments on commit b8f9fab

Please sign in to comment.
Something went wrong with that request. Please try again.