fix TypeError for incompatible app categories on edit page (bug 708263)

This commit is contained in:
Chris Van 2011-12-14 17:51:31 -08:00
Родитель 3e5d0aae7d
Коммит 29a9c2a07d
2 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -16,6 +16,7 @@ from access import acl
import amo
import captcha.fields
from amo.fields import ColorField
from amo.helpers import loc
from amo.urlresolvers import reverse
from amo.utils import slug_validator, slugify, sorted_groupby, remove_icons
from addons.models import (Addon, AddonCategory, AddonUser, BlacklistedSlug,
@ -231,7 +232,7 @@ class CategoryForm(forms.Form):
max_cat = amo.MAX_CATEGORIES
if getattr(self, 'disabled', False) and total:
if categories[0].type == amo.ADDON_WEBAPP:
raise forms.ValidationError(_('Categories cannot be changed '
raise forms.ValidationError(loc('Categories cannot be changed '
'while your app is featured for this application.'))
else:
raise forms.ValidationError(_('Categories cannot be changed '

Просмотреть файл

@ -107,7 +107,7 @@
{% if form.disabled %}
<p class="addon-app-cats addon-app-cats-inline">
<b>{{ form.app.pretty }}:</b>
{% set cats = dict(addon.app_categories).get(form.app) %}
{% set cats = dict(addon.app_categories).get(form.app, []) %}
{{ cats|join(' &middot; ')|safe }}
</p>
<p>