Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Update cms/admin/forms.py #1460

Merged
merged 1 commit into from

2 participants

@neoascetic

Using of cleaned_data['slug'] may raise KeyError, use slug variable instead

@neoascetic neoascetic Update cms/admin/forms.py
Using of `cleaned_data['slug']` may raise `KeyError`,
use `slug` variable instead
eaa9fd6
@digi604 digi604 merged commit 987d7de into divio:develop

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 2, 2012
  1. @neoascetic

    Update cms/admin/forms.py

    neoascetic authored
    Using of `cleaned_data['slug']` may raise `KeyError`,
    use `slug` variable instead
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 5 deletions.
  1. +2 −5 cms/admin/forms.py
View
7 cms/admin/forms.py
@@ -92,10 +92,7 @@ def __init__(self, *args, **kwargs):
def clean(self):
cleaned_data = self.cleaned_data
- if 'slug' in cleaned_data.keys():
- slug = cleaned_data['slug']
- else:
- slug = ""
+ slug = cleaned_data.get('slug', '')
page = self.instance
lang = cleaned_data.get('language', None)
@@ -123,7 +120,7 @@ def clean(self):
title = page.get_title_obj(lang)
if title:
oldslug = title.slug
- title.slug = self.cleaned_data['slug']
+ title.slug = slug
title.save()
try:
is_valid_url(title.path,page)
Something went wrong with that request. Please try again.