Skip to content

Hyperlink Class Cannot Be Pickled #3628

Closed
@mlavin

Description

@mlavin

Related to #3350, the rest_framework.relations.Hyperlink instances cannot be pickled as demonstrated with this sample:

>>> import pickle
>>> from rest_framework.relations import Hyperlink
>>> link = Hyperlink('http://example.com', 'test')
>>> pickle.loads(pickle.dumps(link))
Traceback (most recent call last):
  File "<console>", line 1, in <module>
TypeError: __new__() missing 1 required positional argument: 'name'

For serializers which use the hyperlink relations, this breaks the caching of the response objects since most of the cache backends rely on pickle by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions