Просмотр исходного кода

Populate settings table correctly.

Rafał Pitoń 11 лет назад
Родитель
Сommit
044a4cb906
1 измененных файлов с 6 добавлено и 4 удалено
  1. 6 4
      misago/conf/migrationutils.py

+ 6 - 4
misago/conf/migrationutils.py

@@ -77,12 +77,14 @@ def migrate_settings_group(orm, group_fixture, old_group_key=None):
         if (setting_fixture.get('field_extra') and
         if (setting_fixture.get('field_extra') and
                 setting_fixture.get('field_extra').get('choices')):
                 setting_fixture.get('field_extra').get('choices')):
             untranslated_choices = setting_fixture['field_extra']['choices']
             untranslated_choices = setting_fixture['field_extra']['choices']
-            translated_choices = []
-            if untranslated_choices != '#TZ#':
+            if untranslated_choices == '#TZ#':
+                setting_fixture['field_extra']['choices'] = '#TZ#'
+            else:
+                translated_choices = []
                 for value, name in untranslated_choices:
                 for value, name in untranslated_choices:
                     translated_choices.append((value, original_message(name)))
                     translated_choices.append((value, original_message(name)))
-            setting_fixture['field_extra']['choices'] = tuple(
-                translated_choices)
+                setting_fixture['field_extra']['choices'] = tuple(
+                    translated_choices)
 
 
         try:
         try:
             value = custom_settings_values[setting_fixture['setting']]
             value = custom_settings_values[setting_fixture['setting']]