|
if self.structure in default_fields.keys(): |
There is no corresponding else to the above if statement, which sets the correct data formatter to use on the data structure found in a query response. This means that if a data type isn't included in the default_fields dict, the client will attempt to format the response using whatever data formatter had previously been set.
To reproduce: run the serieses query and then the books query. Serieses are included in default_fields and books are not. The books query will raise an error showing that the client had attempted to format the response as though it were a set of serieses (hitting an error when no seriesName was found).
The example is from v0.9.0, but the issue also occurs in earlier versions of structures.py.
thoth-client/thothlibrary/thoth-0_9_0/structures.py
Line 325 in 2239642
There is no corresponding
elseto the aboveifstatement, which sets the correct data formatter to use on the data structure found in a query response. This means that if a data type isn't included in thedefault_fieldsdict, the client will attempt to format the response using whatever data formatter had previously been set.To reproduce: run the
seriesesquery and then thebooksquery. Serieses are included indefault_fieldsand books are not. Thebooksquery will raise an error showing that the client had attempted to format the response as though it were a set of serieses (hitting an error when noseriesNamewas found).The example is from v0.9.0, but the issue also occurs in earlier versions of
structures.py.