Opened 5 years ago
Closed 4 years ago
#31529 closed New feature (fixed)
Add support for pathlib and os.PathLike in migrations serializer.
Reported by: | Nick Pope | Owned by: | Nick Pope |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Normal | Keywords: | pathlib migrations serializer |
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
Some of these types do not serialize as expected or at all.
- We can serialize instances of
os.PathLike
tostr
orbytes
by usingrepr(os.fspath(value))
. - We can serialize pathlib instances, converting to
pathlib.PurePosixPath
orpathlib.PureWindowsPath
.
It is necessary to serialize concrete paths to pure paths to avoid migrations that are incompatible on different operating systems.
Change History (4)
comment:1 by , 5 years ago
Has patch: | set |
---|
comment:2 by , 5 years ago
Component: | Database layer (models, ORM) → Migrations |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 4 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Note:
See TracTickets
for help on using tickets.
PR