Login

utf8-friendly dumpdata management command for yaml (no escape symbols)

Author:
mucius
Posted:
May 17, 2013
Language:
Python
Version:
1.5
Tags:
fixtures management dumpdata
Score:
0 (after 0 ratings)

This is a YAML version of http://djangosnippets.org/snipptes/2397

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
""" pretty serialization for yaml """
import yaml
from django.core.serializers.pyyaml import (  # IGNORE:W0611
    Serializer as YamlSerializer, DjangoSafeDumper,
    Deserializer)  # @UnusedImport


class Serializer(YamlSerializer):
    """ utf8-friendly dumpdata management command """
    def end_serialization(self):
        yaml.dump(self.objects, self.stream, allow_unicode=True,
                  default_flow_style=False,
                  Dumper=DjangoSafeDumper, **self.options)

More like this

  1. utf8-friendly dumpdata management command (no escape symbols) #2 by kmike 4 years, 2 months ago
  2. utf8-friendly dumpdata management command (no escape symbols) #3 by inductor 2 years ago
  3. utf8-friendly dumpdata management command (no escape symbols) by dirol 4 years, 6 months ago
  4. Navigation list from YAML file by sean2000 7 years, 4 months ago
  5. streaming dump_data by kcarnold 6 years, 2 months ago

Comments

Please login first before commenting.