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 to str or bytes by using repr(os.fspath(value)).
  • We can serialize pathlib instances, converting to pathlib.PurePosixPath or pathlib.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 Nick Pope, 5 years ago

Has patch: set

comment:2 by Mariusz Felisiak, 5 years ago

Component: Database layer (models, ORM)Migrations
Triage Stage: UnreviewedAccepted

comment:3 by Mariusz Felisiak, 4 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In 074844e9:

Fixed #31529 -- Added support for serialization of pathlib.Path/PurePath and os.PathLike in migrations.

Note: See TracTickets for help on using tickets.
Back to Top