Skip to content

Hyperlink Class Cannot Be Pickled #3628

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy