Commits

sodas tsai committed 9ae42be

Show patches in debug setting mode

  • Participants
  • Parent commits c045fe9

Comments (0)

Files changed (1)

File beanstalk/tasks/utils.py

         # Print Settings dict in each level
         settings_path_length = len(setting_paths)
         last_settings_dict = {}
-        for i in xrange(1, settings_path_length + 1):
-            local_settings_dict = SettingsDict(*setting_paths[:i])
+        for i in xrange(1, settings_path_length + 2):
+            if i <= settings_path_length:
+                local_settings_dict = SettingsDict(*setting_paths[:i])
+                title = 'Settings with {path}'.format(path=setting_paths[i - 1])
+            else:
+                local_settings_dict = setting_patches
+                title = 'Settings with from patches'
+
+            if not local_settings_dict:
+                continue
+
+            print cyan(title)
             diff_items = [(key, local_settings_dict[key]) for key in local_settings_dict.keys()
                           if (key not in last_settings_dict) or
                              (key in last_settings_dict and last_settings_dict[key] != local_settings_dict[key])]
             sorted_items = sorted(diff_items, cmp=lambda x, y: cmp(x[0], y[0]))
 
-            print cyan('Settings with {path}'.format(path=setting_paths[i - 1]))
             for key, value in sorted_items:
                 output = '{0} = {1}'.format(key, value)
                 print output if value == beanstalk_settings[key] else yellow(' * ' + output)