Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update cms/admin/forms.py

Using of `cleaned_data['slug']` may raise `KeyError`,
use `slug` variable instead
  • Loading branch information...
commit eaa9fd6c46b2cfe2896bf093f97056c533dfeb4d 1 parent a2fdb53
@neoascetic neoascetic authored
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)
Please sign in to comment.
Something went wrong with that request. Please try again.