[Django] #31529: Add support for pathlib and os.PathLike in migrations serializer.

21 views
Skip to first unread message

Django

unread,
May 1, 2020, 10:38:13 AM5/1/20
to django-...@googlegroups.com
#31529: Add support for pathlib and os.PathLike in migrations serializer.
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: New | Status: assigned
feature |
Component: Database | Version: master
layer (models, ORM) | Keywords: pathlib migrations
Severity: Normal | serializer
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/31529>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 1, 2020, 10:41:27 AM5/1/20
to django-...@googlegroups.com
#31529: Add support for pathlib and os.PathLike in migrations serializer.
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: pathlib migrations | Triage Stage:
serializer | Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Nick Pope):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/12839 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/31529#comment:1>

Django

unread,
May 1, 2020, 2:10:16 PM5/1/20
to django-...@googlegroups.com
#31529: Add support for pathlib and os.PathLike in migrations serializer.
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: New feature | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: pathlib migrations | Triage Stage: Accepted
serializer |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* component: Database layer (models, ORM) => Migrations
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/31529#comment:2>

Django

unread,
Jun 24, 2020, 5:07:40 AM6/24/20
to django-...@googlegroups.com
#31529: Add support for pathlib and os.PathLike in migrations serializer.
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: New feature | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: pathlib migrations | Triage Stage: Ready for
serializer | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/31529#comment:3>

Django

unread,
Jun 24, 2020, 5:46:39 AM6/24/20
to django-...@googlegroups.com
#31529: Add support for pathlib and os.PathLike in migrations serializer.
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: New feature | Status: closed
Component: Migrations | Version: master
Severity: Normal | Resolution: fixed

Keywords: pathlib migrations | Triage Stage: Ready for
serializer | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"074844e9479a9ee1420685b36189aa2881289993" 074844e9]:
{{{
#!CommitTicketReference repository=""
revision="074844e9479a9ee1420685b36189aa2881289993"
Fixed #31529 -- Added support for serialization of pathlib.Path/PurePath
and os.PathLike in migrations.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31529#comment:4>

Reply all
Reply to author
Forward
0 new messages