After deploying AskBot I observe an unusual error:
AttributeError at /settings/QA_SITE_SETTINGS/
'SortedDict' object has no attribute 'insert'
This is the result of the following code:
langs_dict = SortedDict(django_settings.LANGUAGES)
default_code = django_settings.LANGUAGE_CODE
default_name = langs_dict[default_code]
langs_dict.insert(0, default_code, default_name)
According to Django wiki, SortedDict
seems to have insert
method.
Any idea?
Here is the complete error page.
Related: AskBot bug.
The SortedDict.insert
method was deprecated in Django 1.5, and removed in Django 1.7. The wiki page you linked to was out of date, so I removed the mention of the insert
method from there.
SortedDict
itself is deprecated in Django 1.7, and will be removed in Django 1.9.
Now that Django only supports Python 2.7+, the correct fix is to use collections.OrderedDict
instead of SortedDict
.