Changes between Version 82 and Version 83 of pyson


Ignore:
Timestamp:
11/05/24 15:49:45 (3 weeks ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • pyson

    v82 v83  
    7676The following types are recognised and handled separately:
    7777
    78 NoneType, int, float, bool, str, complex, range, bytes, bytearray, datetime, [https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/wiki/uri URI], UUID, Decimal, dict, list, Exceptions (see below)
     78NoneType, int, float, bool, str, complex, range, bytes, bytearray, datetime, [https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/wiki/uri URI], UUID, Decimal, dict, list, Exceptions (see below). objects of type Type (class objects) are also treated specially.
    7979
    8080The dict and list are treated even more special as we also support the List[TYPE] and Dict[KEYTYPE, VALUETYPE] types.
     
    9696Serialization of an exception gives {{{ {"message":"...", "cause": EX, "stackTrace":[]} }}} where EX is either None or another serialized exception. This format tries to maximize compatibility with the jackson way of serializing exceptions. The "stackTrace" field is always empty because python does not include the stacktrace with exceptions; it's there only for compatibility of the format with java. Note that the type of the exception is not included (as in jackson).
    9797Deserialization takes a dict with at least a "message" field. The constructor of the provided class is called with this message, so make sure that your exception constructor takes the message as the constructor argument. If the dict contains a cause, the cause is also parsed recursively, as general Exception, and attribute {{{__cause__}}} of the exception is filled with the result.
     98
     99=== Type[X]
     100Objects of type Type[Clazz[ are class objects. For example, Type[Bid] is referring to the class Bid. They are serialized as the full.path.to.Clazz. For deserialization, the class is loaded and checked whether it's a subtype of the specified type. Note, Type[Bid] refers to an object of class Bid, where Bid refers to an instance of class Bid.
    98101
    99102== Decorators