Opened 17 years ago
Closed 17 years ago
#5268 closed (fixed)
Remove Python specific types from YAML output (use safe_dump?)
Reported by: | Owned by: | Daniel Poelzleithner | |
---|---|---|---|
Component: | Core (Serialization) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
dumps produced by yaml.dump are not very language neutral.
safe_dump=True as serialize parameter will call yaml.safe_dump which doesn't have this problem.
Attachments (2)
Change History (8)
by , 17 years ago
Attachment: | patch_yaml_safe_dumper.txt added |
---|
comment:1 by , 17 years ago
Configurability is great, but is there any compelling reason that we shouldn't just change the implementation to use safe_dump all the time? I'm not a YAML expert, but looking at the PyYAML docs, it appears that the only place the difference would matter is when serializing 'arbitrary Python objects'. I don't think we need this capability, and if we are, we should be able to work around it without too much difficulty.
comment:2 by , 17 years ago
a unicode object for example is considered a 'arbitrary Python objects'. this creates such nice looking dumps like:
https://db.leipzig.freifunk.net/dns/yaml/domain/list/
the !!python/unicode is not very portable. however, i asked the yaml programmer about this issue befor filling this bug
and he said suggested using safe_dump.
i'm not so sure about this, using dump has many advantages when it comes to terms of mapping verify presice things.
I'm thinking about writing a extended mapper that causes relations to be mapped like the model.
But for portability reasons this is not suggested, therefor I suggest this argument.
comment:3 by , 17 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:4 by , 17 years ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
Summary: | add yaml save_dump argument → Remove Python specific types from YAML output (use safe_dump?) |
Triage Stage: | Design decision needed → Accepted |
Ok. I'm -1 to adding a safe_dump argument to the serializer. However, I agree that the output format is not pretty. I've changed the ticket title to reflect the underlying problem.
It looks as if the YAML output has changed significantly since the unicode branch was merged - this is the underlying problem that should be solved. The solution may be to switch to using safe_dump all the time - I'll leave that decision to whoever tackles this problem.
comment:5 by , 17 years ago
Needs tests: | unset |
---|---|
Owner: | changed from | to
Patch needs improvement: | unset |
Status: | new → assigned |
Triage Stage: | Accepted → Ready for checkin |
comment:6 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
add safe_dump argument to yaml serializer