Code

Ticket #13182: dumpdata-json.patch

File dumpdata-json.patch, 1.7 KB (added by stephaner, 4 years ago)

Remove trailing whitespace and cosmetic changes (import of get_models, spaces)

  • django/core/serializers/json.py

     
    2525        self.options.pop('stream', None) 
    2626        self.options.pop('fields', None) 
    2727        self.options.pop('use_natural_keys', None) 
     28        if self.options.get('indent', None): 
     29            # The default is (', ', ': ').  To eliminate useless whitespaces 
     30            # after comma, the representation is changed to (',', ': ') only 
     31            # if indent is used 
     32            self.options['separators'] = (',', ': ') 
     33 
    2834        simplejson.dump(self.objects, self.stream, cls=DjangoJSONEncoder, **self.options) 
    2935 
    3036    def getvalue(self): 
  • django/core/management/commands/dumpdata.py

     
    2424    args = '[appname ...]' 
    2525 
    2626    def handle(self, *app_labels, **options): 
    27         from django.db.models import get_app, get_apps, get_models, get_model 
     27        from django.db.models import get_app, get_apps, get_model 
    2828 
    29         format = options.get('format','json') 
    30         indent = options.get('indent',None) 
     29        format = options.get('format', 'json') 
     30        indent = options.get('indent', None) 
    3131        using = options.get('database', DEFAULT_DB_ALIAS) 
    3232        connection = connections[using] 
    33         exclude = options.get('exclude',[]) 
     33        exclude = options.get('exclude', []) 
    3434        show_traceback = options.get('traceback', False) 
    3535        use_natural_keys = options.get('use_natural_keys', False) 
    3636