wagtail / telepath

A library for exchanging data between Python and JavaScript
https://wagtail.github.io/telepath/
BSD 3-Clause "New" or "Revised" License
143 stars 4 forks source link

Add support for packing Python objects to primitive values #9

Closed gasman closed 2 years ago

gasman commented 2 years ago

Sometimes it's appropriate for the JS representation of an object to be a plain JSON-serializable value such as a string, rather than a custom-defined object. This would be possible by registering a subclass of StringAdapter / BaseAdapter, except register has over-zealous validation that rejects anything other than object-based Adapters. Relax this validation and add some documentation to make this use-case official.